Created
August 22, 2015 02:01
-
-
Save chuck0523/bc09c9bf2d49ba2e1c07 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() { | |
var log = function(x) {console.log(x)} | |
var a = [2, 5, 8, 42, 12]; | |
var x; | |
x = _.find(a, function(num) { | |
return num > 5; | |
}); | |
//log(x); | |
x = _.filter(a, function(num) { | |
return num > 5; | |
}); | |
//log(x); | |
x = _.contains(a, 10); | |
//log(x); | |
for(var i = 0; i < a.length; i++) { | |
if(a[i] > 5) { | |
x = a[i]; | |
break; | |
} | |
} | |
x = []; | |
for(var i = 0; i < a.length; i++) { | |
if(a[i] > 5) { | |
x.push(a[i]); | |
} | |
} | |
log(x); | |
x = false; | |
for(var i = 0; i < a.length; i++) { | |
if(a[i] == 5) { | |
x = !x; | |
break; | |
} | |
} | |
log(x); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment