咱們用Object.values的方法
var obj={
id:'111',
name:'yfx',
sex:'男'
}
var t=Object.values(obj).filter(item=>item)
console.log(t)//['111','yfx','男']
要是想講key值放在數組中:
var obj={
id:'111',
name:'yfx',
sex:'男'
}
var t=Object.keys(obj)
console.log(t)//['id','name','sex']複製代碼