Everything be true intermediate algorithm

hi guys i can’t seem to solve this challenge completely. i have 3 requirements unticked and i can’t seem to diagnose the problem. help please!

function truthCheck(collection, pre) {
  // Is everyone being true?
  for ( let i = 0; i < collection.length; i++) {
  let allProperties =  Object.keys(collection[i])

for (let property in allProperties) {

if ((!collection[i].hasOwnProperty(pre)) || allProperties[pre] !== true ) {
 return false;
}

}

  }

  return true;
}

console.log(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"));

ooo thank you i solved it… i’ve taken out what i didn’t need to use as well :grinning::smile:

function truthCheck(collection, pre) {
  // Is everyone being true?
  for ( let i = 0; i < collection.length; i++) {

if ((!collection[i].hasOwnProperty(pre)) || !collection[i][pre] ) {
 return false;
 
}

  }

  return true;
}

console.log(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"));

mhm let me think… so this alone checks if its truthy --> !collection[i][pre]

It doesn’t check only if its value is truthy, it also checks if the “pre” property is existent? because if “pre” is existent then its considered truthy? correct if im wrong because its able to substitute “.hasOwnProperty”

oh yeah that’s a good way to put it lol i can’t seem to think of it that way