这是我的程序片段:
var items = {"43":"1255","44":"1243","45":"8080","46":"9898"};
var result = Object.keys(items).map(function(e) {
return [items[e],Number(e)];
});
console.log(result);
我需要根据值对items
进行排序,以便输出 JSON ,如下所示:
{
"44":"1243",
"43":"1255",
"45":"8080",
"46":"9898"
};