0
点赞
收藏
分享

微信扫一扫

js中类数组对象转数组


const obj = {
"0":"vv",
"1":12,
"2":"male",
"3":123456,
length:4
}

const arr = Array.from(obj);

console.log(arr); // ['vv', 12, 'male', 123456]

for (const item of arr) {
console.log(item);
}


举报

相关推荐

0 条评论