1 var obj = { 2 0:1, 3 1:2, 4 2:3, 5 length:3 6 }; 7 function toArray(obj){ 8 return Array.prototype.slice.call(obj); 9 }; 10 11 console.log(toArray(obj));//[1,2,3]
1 var obj = { 2 0:1, 3 1:2, 4 2:3, 5 length:3 6 }; 7 function toArray(obj){ 8 return Array.prototype.slice.call(obj); 9 }; 10 11 console.log(toArray(obj));//[1,2,3]