3 ms·
I didn't know about that function syntax. Does it work just like the arrow function syntax? [1,2,3,4].map(x => x * x) // [1,4,9,16] I wonder why they incl
by epidemian 13y ago
I didn't know about that function syntax. Does it work just like the arrow function syntax?
[1,2,3,4].map(x => x * x) // [1,4,9,16]
I wonder why they included two new shorter function syntax alternatives. Is one of them recommended/deprecated?
- camus 13y agoone is standard the other is not.
- altrego99 13y agoThis doesn't seem to work on Firefox 21 shell. Does it work on FF 22?
- epidemian 13y agoYep, it seems it was added on Firefox 22: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/arrow_functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe.... It also seems it's the proposal for ES6: http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax http://wiki.ecmascript.org/doku.php?id=harmony:arrow_functio.... This blog post explains the differences between these functions and current functions: http://javascriptweblog.wordpress.com/2012/04/09/javascript-fat-city/; http://javascriptweblog.wordpress.com/2012/04/09/javascript-... i wish the unbound "->" alternative is included, so that functions used as methods can also use the new syntax.
- altrego99 13y agoWhich Firefox version does this syntax work on? It's not working on my 21.0.