Hacker News new | ask | show | jobs
by bemmu 2561 days ago
If you want to get terse

    ['1', '7', '11'].map(x => +x)
2 comments

If I didn't care about rounding I'd just use a primitive constructor

    ['1', '7', '11'].map(Number)
This coerces to a number, but not to an integer.
I would hate to see it in code that is being shared in a team, but the following works:

['1', '7', '11'].map(x => ~~x)