Hi Megha Pathak congratulations to you on your new job role at Hashnode. I love your write up, I love Hashnode and look forward to an awesome experience working at Hashnode someday!
The first code in your article could be refactored to the following;
const num2 = 3;
const multiplyBy2 = function (inputNumber) {
return inputNumber*2;
};
// multiplyBy2(10) Output = 20, and multiplyBy2(num2) Output = 6
// It can even be slimmed down more further.
const num2 = 3;
const multiplyBy2 = inputNumber => inputNumber*2;
// multiplyBy2(10) Output = 20, and multiplyBy2(num2) Output = 6
This is for anyone willing to learn other ways to simplify the code even further and also see how Higher Order Functions come into play!
Happy Coding!
Why did you use "~~" for Arrow function?
By the way Thanks, learned a lot...!!
Rahul
hustling
This is an amazing post. My version of this was not good but this post is helpful and amazing.