-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'] 
yyz_vanvlet
  • 171
  • 2
  • 8

1 Answers1

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])
eliezra236
  • 547
  • 1
  • 4
  • 16