Is there a similar thing for coffescript?
You're probably better off just switching to ES6, but that's just my opinion.
51–60 of 89 posts
Is there a similar thing for coffescript?
You're probably better off just switching to ES6, but that's just my opinion.
No, let is hoisted to the top of the enclosing scope [1] ("temporal dead zone" notwithstanding). let, however, is not hoisted to the top of the enclosing function.
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
The only thing from this list of new ES6 idioms that doesn't sit comfortably with me is the short-hand for creating classes. I remember being kind of blown away way back in the day with the prototypical/functional nature of Javascript and how you could wrangle something into being that behaved in an object-oriented manner just like other languages that had explicit class declaration and object instantiation. Part of…
I think the cheatsheet does a great job of summarizing what makes me uncomfortable with es6 classes: >"...the syntax for creating classes in ES6 obscures how implementation and prototypes work under the hood..." Yes, it's great for if you're uncomfortable with prototypal inheritance and the "javascript way of doing things" (I'll maybe summarize that as composition over inheritance, mixins, knowing how to use call/app…
Using "this" as a key into a Map of private variables looks bizarre. I would rather keep my code concise than create a layer of obfuscation.
Is "WeakMap" really the suggested way to implement private class properties? Using "this" as a key into a Map of private variables looks bizarre. I would rather keep my code concise than create a layer of obfuscation.
The only thing from this list of new ES6 idioms that doesn't sit comfortably with me is the short-hand for creating classes. I remember being kind of blown away way back in the day with the prototypical/functional nature of Javascript and how you could wrangle something into being that behaved in an object-oriented manner just like other languages that had explicit class declaration and object instantiation. Part of…
I don't think it's reasonable to eliminate inheritance (it's very useful when it's needed) but restricting it down from what Javascript currently provides natively is a good thing.
Great reference and overview of ES6. One minor quibble. I was bothered by the misuse of the words "lexical" and "interpolate". The lexical value of the keyword "this " is the string "this". Then, you might translate between two technologies such as CommonJS and ES6 but interpolating between them implies filling in missing data by averaging known values. Granted this word is commonly abused. Sorry this is a bit pedant…
> By sticking to this paradigm, we make our code easily readable and allow ourselves to interpolate between CommonJS and ES6 modules. This sentence should probably say "interoperate"