Skip to content

Instantly share code, notes, and snippets.

@yajamon
Last active August 29, 2015 14:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save yajamon/6d17a5cb6482102b66dd to your computer and use it in GitHub Desktop.
function eachArray (arr, callback){
var length = arr.length;
for(var index=0; index<length; ++i){
callback(arr[index], index);
}
}
function exists5 (arr){
eachArray(arr, function(value, index){
if (arr[index] === 5) {
console.log('exists 5!');
// break;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment