I have an JSON file:
['0': XXX, '1': YYYY]
I would like to extract this into an array with only the value via jquery.
['XXX', 'YYYY']
What is the best way to do this?
.makeArray doesn't seem to work.
I have an JSON file:
['0': XXX, '1': YYYY]
I would like to extract this into an array with only the value via jquery.
['XXX', 'YYYY']
What is the best way to do this?
.makeArray doesn't seem to work.
Use Object.values():
var data = {
'0': 'XXX',
'1': 'YYYY'
};
var valuesOnly = Object.values(data);
console.log(valuesOnly);