JavaScript
Article
By Sam Deering

jQuery .each() skip to next one

By Sam Deering

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

--ADVERTISEMENT--

//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;
});
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account