4 ms·
On an unrelated note, do arrow functions inherit the parent context's `this` and `arguments` correctly in Node or io.js now?
by vortico 12y ago
On an unrelated note, do arrow functions inherit the parent context's `this` and `arguments` correctly in Node or io.js now?
- talles 12y agoGood question, I wonder that too. I'm kinda tired of var that = this.
- bl4ckm0r3 12y agoThat's why!
- sync 12y agoThey definitely inherit `this`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- SanderMak 12y agoI believe the arguments should not be available in arrow functions according to the spec. (source: discussion here https://github.com/Microsoft/TypeScript/issues/1609 https://github.com/Microsoft/TypeScript/issues/1609)
- benologist 12y agoThey explicitly do that in ES6: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- vortico 12y agoRight, but implementation hadn't caught up to spec since I last checked.
- benologist 11y agoIt's natively supported in typescript and iojs, and babel (prev. 6to5) + other libs enable it in browsers.