Created
June 23, 2014 20:18
-
-
Save letsgetrandy/52d7d0da1f14dc4cbe8a to your computer and use it in GitHub Desktop.
A few semantic functions for Javascript...
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
/** | |
* Returns TRUE if all arguments passed in can be evaluated as true. | |
* Otherwise, returns FALSE. | |
*/ | |
function all() { | |
var i, l = arguments.length; | |
for (i = 0; i < l; i++) { | |
if (!arguments[i]) { | |
return false; | |
} | |
} | |
return true; | |
} |
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
/** | |
* Returns TRUE if any argument passed in can be evaluated as true. | |
* Otherwise, returns FALSE. | |
*/ | |
function any() { | |
var i, l = arguments.length; | |
for (i = 0; i < l; i++) { | |
if (arguments[i]) { | |
return true; | |
} | |
} | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment