xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

js sort map by key

js sort map by key

Map

map to array

// Array.from()



Object

  let obj = {};
  for(let key of Object.keys(obj).sort()) {
    log(`key`, key, obj[key])
    strs.push(obj[key]);
  }

refs

https://stackoverflow.com/questions/5467129/sort-javascript-object-by-key

https://stackoverflow.com/questions/37982476/how-to-sort-a-map-by-value-in-javascript



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-11-11 23:11  xgqfrms  阅读(185)  评论(2编辑  收藏  举报