-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Labels
Description
let obj = {1:222, 2:123, 5:888};
obj.length = 12;
let _obj = Array.from(obj).slice(1);
let newObj = _obj.map((item) => {if(item === undefined) {return null;} else {return item;}});
console.log(newObj);
let obj = {1:222, 2:123, 5:888};
obj.length = 12;
obj[Symbol.iterator] = Array.prototype[Symbol.iterator];
let _obj = [...obj].slice(1);
let newObj = _obj.map((item) => {if(item === undefined) {return null;} else {return item;}});
console.log(newObj);
思考:
let _obj = [].slice.call(obj);
JerryLin233, wz71014q, liujuntao123, gdh51, Xu-Angel and 8 morewave52, kakuaka, aoping, LMchensir, Qiaooowo and 7 more