I’m new in JS… can someone help me to change this:
arr = [{type:'fruit', name:'apple', color:'red'},{type:'fruit', name:'banana', color:'yellow'}]
to this:
arr = [['fruit', 'apple', 'red'],['fruit', 'banana', 'yellow']]
Advertisement
Answer
You can map your array using Object.values()
as a callback:
arr = arr.map(Object.values);