4 ms·
Sure, but to update their example using the new format, you'd say: ["1","2","3"].map(parseInt); // returns [1, NaN, NaN] The gotcha trap is still there, a
by ccooffee 3y ago
Sure, but to update their example using the new format, you'd say:
["1","2","3"].map(parseInt); // returns [1, NaN, NaN]
The gotcha trap is still there, and is just as likely to get through a code review.
- latexr 3y agoYes, you still need to know that you have to do this, but my point is that the author started with the quoted alternative and abandoned it because it had two problems (verbose, inelegant) which are eliminated in ES6, making the `Function.prototype.only` solution unnecessary.