Remove array quotes with two positions

Asked

Viewed 53 times

1

Hello, Someone could help me, I’m trying to remove the quotes from an array with two javascript positions. Something like:

["1", "2"]

Become:

[1, 2]

1 answer

3

Do you want to convert all values into number? You can use the method map of the array for this:

let lista = ["1", "2"].map( s => Number(s) );
  • 1

    Boa @bfavaretto!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.