arrow function syntax simplified
Kevin Smith
khs4473 at gmail.com
Mon Apr 2 18:21:55 PDT 2012
>
> Object.getOwnPropertyNames(Math).forEach((key) => {
> if (typeof Math[key] === 'function') Number.prototype[key]= () =>
> Math[key](this);
> });
>
Hi Jorge,
Here you are defining a method, for which arrows are inappropriate.
Long-hand functions are appropriate in this case.
Object.getOwnPropertyNames(Math).forEach(key => {
if (typeof Math[key] === "function")
Number.prototype[key] = function() { return Math[key](this); };
});
No one's attempting to deprecate long-hand functions. Arrow functions fill
a different need.
kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120402/397de967/attachment.html>
More information about the es-discuss
mailing list