let arr = [1:"2",3:"3"]
console.log(Object.values(arr) )//字符串 2 3
console.log( Number(Object.values(arr)) )//纯数字 2 3
Object.values()和Object.keys()一起用
let data= {
测试1: ['≥', '1'],
测试2: ['', '1']
}
let oneList = Object.keys(data)
let cheilde = Object.values(data)
let nameList = []
let maxDa = "≥"
let small = "<"
oneList.map(item => {
let name = item
nameList.push({
name: name,
})
})
cheilde.map(item => {
let math = ""
let sum = ""
if (maxDa == item[0]) {
math = item[0]
sum = item[1]
nameList.map(clos => {
clos.where = (1).toString()
clos.num = item[1]
})
// console.log(item[0], item[1])
} else if (small == item[0]) {
nameList.map(clos => {
clos.where = (2).toString()
clos.num = item[1]
})
}
})
console.log(nameList)