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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -