I am trying to figure out how to loop through several array arguments passed. For example: [1,2,3,4,5],[3,4,5],[5,6,7] If I pass it to a function, how would I have a functi
Use forEach, as below:
'use strict'; function doSomething(p1, p2) { var args = Array.prototype.slice.call(arguments); args.forEach(function(element) { console.log(element); }, this); } doSomething(1); doSomething(1, 2);