Tell us what’s happening:
Hello everyone,
I’m stuck at this exercise, i have the code below and I dont understand why it does not validate everywhere.
Actually i dont understand some of the requirements like this one:
truthCheck([{“single”: “”}, {“single”: “double”}], “single”) should return false - WHY? ‘single’ exists in every element of the collection …
Thank you in advance for your input.
Your code so far
// Is everyone being true?
var bool = false
Object.keys(collection).forEach(function(key) {
if (collection[key].hasOwnProperty(pre)) {
console.log(collection[key].hasOwnProperty(pre))
bool += true
} else {
bool += false
}
})
if (bool < collection.length) {
return false
} else {
return true
}
}```
**Your browser information:**
Your Browser User Agent is: ```Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36```.
**Link to the challenge:**
https://www.freecodecamp.org/challenges/everything-be-true