Array.prototype.slice weird behaviour
javascript
Solution
Because in order for `Array.prototype.slice` to work, you need to pass an array-like object. And in order for an object to fit that category, it needs a `length` property, which your object doesn't have. Try this:
var arr = { '0': 1, '1': 2, '2': 3, '3': 4, '4': 5 };
arr.length = 5;
var res = Array.prototype.slice.call(arr);
console.log(res);
FIDDLE
Problem
Consider this piece of code, with console output at the end of each line: ``` function whatever() { console.log(arguments) // { '0': 1, '1': 2, '2': 3, '3': 4, '4': 5 } console.log(Array.prototype.slice.call(arguments)) // [ 1, 2, 3, 4, 5 ] console.log(Array.prototype.slice.call({ '0': 1, '1': 2, '2': 3, '3': 4, '4': 5 })) // [] } whatever(1,2,3,4,5) ``` Why is it that the third `console.log` outputs an empty array?