Skip to content

Instantly share code, notes, and snippets.

@sebastianherman
Created January 10, 2021 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastianherman/24cffa43427989914d867f9f368b77cb to your computer and use it in GitHub Desktop.
Save sebastianherman/24cffa43427989914d867f9f368b77cb to your computer and use it in GitHub Desktop.
Intermediate Algorithm Scripting: Everything Be True - freeCodeCamp solution
function truthCheck(collection, pre) {
for (let i in collection) {
if (collection[i].hasOwnProperty(pre)) {
if(!collection[i][pre]) {
return false;
}
} else if (!collection[i].hasOwnProperty(pre)) {
return false;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment