So this code works perfectly
var arr = [1, 2, 3, 4];
arr.forEach(function (el) {
console.log(el);
})
But if i try to do this:
function printArgsInfo() {
arguments.forEach(function (el) {
console.log(el);
});
}
printArgsInfo(2, 3, 2.5, -110.5564, false);
arguments.forEach
is not a function
Even though arguments
is an array and if Itry to do this with a for in
loop it still works.