将JSON数组中的 key 和value 取出 组成对象
let list = ["6", "5", "4", "3", "1","2"]
let lists = []
Object.keys(list).some((key) => {
lists.push({ name: key, age: list[key] })
})
console.log(lists) // 输出结果为
[
0: {name: '0', age: '6'}
1: {name: '1', age: '5'}
2: {name: '2', age: '4'}
3: {name: '3', age: '3'}
4: {name: '4', age: '1'}
5: {name: '5', age: '2'}
]