javascript - How i can can map an large object to an array in es6 -


this question has answer here:

suppose have large object

var object = { a: 1, b: 2, c: 3, d:4, e:5, f:6, g:7, h:8, i:9, j:10 ...}; var array = []; 

output [1,2,3,4,5,6,7,8,9,10...]

how can map object array in es6 ? please me.

you use keys, order them , return value in array.

var object = { a: 1, b: 2, c: 3, d:4, e:5, f:6, g:7, h:8, i:9, j:10};  var array = object.keys(object).sort().map(k => object[k]);    console.log(array);


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -