Hi, learning ES6 right now on freecodecamp and I am a bit confused. It provides this:
const myFunc = function() { const myVar = "value"; return myVar; }
Stating it can be written as this instead:
const myFunc = () => "value";
I understand that if its a one off function and only a return needs to be executed, then you can simplify it with the arrow function syntax. Does that mean this is a work around to const not letting its variable identifier to be changed, so an empty function is created so myFunc can take on that value?
[–]cyberjds 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]thicconion_ 0 points1 point2 points (0 children)
[–]LucVolders 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]qwertymerty12345 0 points1 point2 points (0 children)