Created
October 20, 2016 02:43
-
-
Save basekays/24d3966935736adf99514372a1be24b4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var _ = {}; | |
| _.every = function(list, condition) { | |
| for (var i = 0; i<list.length; i++) { | |
| if (!condition(list[i])) { | |
| return false; | |
| } | |
| } | |
| return true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very close!
condition(list[i])could evaluate to true. and the bang would make it false. so you're just making it the opposite of what it really evaluates to. so ifcondition(list[i])is false, you want to return false. so it would look something like: