jQuery .each() skip to next one

Sam Deering
Share

Workaround jQuery code snippet to skip next interation in a loop. Just documenting this code snippet, no demo sorry.

//output keys=values. eg [1]=[2], [3]=[4] etc, skips undefined keys
var i = 0;
$.each(array, function(key, val)
{
	if (webTrendsParams[i]) {
		console.log(array[i] + ' = ' + array[i+1]);
	}
	i = i + 2;
});