3 ms·
If you want to get terse ['1', '7', '11'].map(x => +x)
by bemmu 7y ago
If you want to get terse
['1', '7', '11'].map(x => +x)
- jacobolus 7y agoThis coerces to a number, but not to an integer.
- reaktivo 7y agoI would hate to see it in code that is being shared in a team, but the following works: ['1', '7', '11'].map(x => ~~x)
- plausibilities 7y agoIf I didn't care about rounding I'd just use a primitive constructor ['1', '7', '11'].map(Number)