News for hackers. Stuff that matters.
Re:Modern Javascript: Everything you missed over the last 10... by dclowd9901 on Saturday May 15, 2021 @03:05PM (#27167938)
And here I thought scope was kind of disaster in JS:

- `const fooFunc = () => {}` is treated differently than `function fooFunc() {}` in declaration and subsequent access.

- A function's invocation context changes depending on how it was declared (fat arrow vs. function declaration)

Don't get me wrong: I love JS, but this is not one of the things I felt made it intuitive.

Re:Modern Javascript: Everything you missed over the last 10... by austincheney on Saturday May 15, 2021 @03:23PM (#27168087)
The this context changes, but I recommend developers not use this. That isn’t a scope issue though.
Re:Modern Javascript: Everything you missed over the last 10... by mweberxyz on Saturday May 15, 2021 @03:30PM (#27168145)
There would be no point in having two ways to do the exact same thing if function-style declaration and arrow-style declaration implementations were identical. Why would they add a new feature to the language if it was purely syntactic sugar?