12
rated 0 times
[
17]
[
5]
/ answers: 1 / hits: 98321
/ 8 Years ago, mon, september 5, 2016, 12:00:00
I was trying to slice an object using Array.prototype, but it returns an empty array, is there any method to slice objects besides passing arguments or is just my code that has something wrong? Thx!!
var my_object = {
0: 'zero',
1: 'one',
2: 'two',
3: 'three',
4: 'four'
};
var sliced = Array.prototype.slice.call(my_object, 4);
console.log(sliced);
More From » arrays