kud
5/16/2017 - 8:49 AM

Transform array of strings to array of numbers.

Transform array of strings to array of numbers.

let elements = ['1', '3', '10']

elements = elements.map(Number)

// returns Array [ 1, 3, 10 ]

Transform array of strings to array of numbers

You have an array of strings and you want to have numbers instead?

This is the trick.