Tell us what’s happening:
Hello,
I’m a bit confused why are we using inline functions in this case and what would be a use of it in regular practice.
Looks like (i) would work the same as (ii) in this case:
const myFunc = () => "value"; // (i)
const myFunc = "value"; // (ii)
and same here:
const magic = () => new Date(); // (i)
const magic = new Date(); // (ii)
So I’m a bit confused in what cases we would need to write those inline functions when we could declare a constant variable and get the same result.
Thank you!
Best regards,
Konstantin
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36
.
Challenge: Use Arrow Functions to Write Concise Anonymous Functions
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions