Skip to content

Instantly share code, notes, and snippets.

@clive-bunting
Created December 5, 2015 15:19
Show Gist options
  • Select an option

  • Save clive-bunting/d84c3c3be3f317c68778 to your computer and use it in GitHub Desktop.

Select an option

Save clive-bunting/d84c3c3be3f317c68778 to your computer and use it in GitHub Desktop.
Bonfire: Everything Be True
// Bonfire: Everything Be True
// Author: @clive-bunting
// Challenge: http://www.freecodecamp.com/challenges/bonfire-everything-be-true#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function every(collection, pre) {
for (var i = 0; i < collection.length; i++) {
if (!collection[i][pre]) {
return false;
}
}
return true;
}
every([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment