Everything Be True - headache

Good evening all…
So I had a small break from the lessons due to some RL issues… and trying to get my head back in the in the game for the last few challenges of this part of the certification…

Here is where I am. Going through this challenge it will require finding the "key: being present in the search to be true… but otherwise it will need to be false…

Here is where I am with the code. :

function truthCheck(collection, pre) {
  // Is everyone being true?
  let result;
  for (let i in collection) {
    for(let z=0,z<= collection.length,z++){
    if (collection[i].hasOwnProperty(pre)) {
      return true;
    } else {
      if (!collection[i].hasOwnProperty(pre)) return false;

    { user: "Tinky-Winky", sex: "male" },
    { user: "Dipsy", sex: "male" },
    { user: "Laa-Laa", sex: "female" },
    { user: "Po", sex: "female" }

The logic requires that once you hit a false value it can end… I am pretty sure this needs a “for loop” for a counter… in order to keep tabs on if the pariticular object it is looking at is the last one in case they are all true…

I would welcome some direction there…

Thank you in advance !

This problem is asking you to determine whether the values are truthy or falsy.

A falsy value is any value that evaluates to false in a Boolean context. Here’s a list of falsy values:

a truthy value is anything that evaluates to true on its own. All values evaluate to true except for values that are falsy.

let x = "";

if (x) {
  this if statement won't execute because x is an empty string 
  which evaluates to false.

x = "Hello, World!";

if (x) {
//this code executes because now x is not a falsy value
1 Like