Created
July 29, 2015 14:24
-
-
Save yajamon/118edd2af646f04ddfab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isFalse (value){ | |
if(value === false) { | |
return true; | |
} | |
return false; | |
} | |
function eachArray (arr, callback){ | |
var length = arr.length; | |
for(var index=0; index<length; ++i){ | |
var retValue = callback(arr[index], index); | |
var breakFlag = isFalse(retValue); | |
breakFlag ? break:; | |
} | |
} | |
function exists5callback (value, index){ | |
if (value === 5) { | |
console.log('exists 5!'); | |
return false; | |
} | |
} | |
function exists5 (arr){ | |
eachArray(arr, exists5callback); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment