5 ms·
Oh yeah - short function syntax goes into the wild! let square = x => x * x Time to move over to stalking the Chrome devs...
by mrspeaker 13y ago
Oh yeah - short function syntax goes into the wild!
let square = x => x * x
Time to move over to stalking the Chrome devs...
- siddboots 13y agoYay. Sometimes I wish we still did release parties.
- creatio 13y agoCan this syntax be also used with the other browsers? i.e. IE and Chrome?
- siddboots 13y agoNot yet, but it is in the ECMAScript 6 draft, so it will most likely be adopted eventually.
- ajryan 13y agoTypeScript supports this syntax. I believe they are trying to align with ECMAScript 6 as much as possible.
- bad_user 13y agoThe nice thing about TypeScript is that it compiles to EcmaScript 3, so you can target older browsers and still use these goodies. Also, TypeScript 0.9 is released, which includes niceties such as generics and type info overloading based on constant values passed in function parameters. It's pretty slick, if only it could output code optimized for Google Closure's advanced mode, for tree-shaking awesomeness.
- blueveek 13y agoNot to mention that |this| is lexically bound in the case of fat arrow functions. No more ".bind(this)" or "let self = this;" everywhere! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/arrow_functions#Lexical_this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...