-4

The variable i have:

var array = [['test1', 0], ['test2', 3], ['test4', 45]] 

So i need some type of flatten but just for the first values of every array, the output should be:

['test1', 'test2', 'test4'] 
4

1 Answer 1

1

Try using Array.map https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

var array = [['test1', 0], ['test2', 3], ['test4', 45]] 

var arrayMapd = array.map(item => item[0])
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.