jQuery jAM, Season 6

Exercise 5.4

Every and Then Some

Predicate

	 

function every(array, predicate){
	for (var i = 0; i < array.length; i = i + 1){
	if(!predicate(array[i]))
		return false;
	}
		return true;
	}

function some(array, predicate){
	for(var i = 0; i < array.length; i = i + 1){
		if(predicate(array[i]))
		return true;
	}
		return false;
	}

	 
	

To open the JavaScript console, press F12 or on MAC press COMMAND-OPTION-I.