I’m learning javascript and saw this code:
const myFunc = () => "value"
why does it use function(without body) instead of normal variable here?
I’m learning javascript and saw this code:
const myFunc = () => "value"
why does it use function(without body) instead of normal variable here?
Thanks man. In this case why do we need a function while there is no logic inside it?
It does have logic.
It is a getter method that accepts no parameters (what you are mistaking as no body) and returns the string-value “value”.
Yes it’s in a FCC lesson
I got it, thank you so much.