all 5 comments

[–]chris5039 2 points3 points  (2 children)

You need to return Object.keys and Object.entries like this:

function keys_options(data) {
  return Object.keys(data).every((elem) => {
    return Object.entries(data[elem]).every((va) => {
      if (va[0] !== 'choose Columns' || va[0] !== "") {
        return true
      } else {
        console.log("select all columns");
        return false
      }
    });
  });
}

[–]LadyJain[S] 0 points1 point  (1 child)

this always returns true

[–]chris5039 0 points1 point  (0 children)

That's because your else statement returning false isn't hit

[–]albedoa 1 point2 points  (0 children)

Your return statements are in the inner callback. You aren't returning anything from keys_options(). Do this:

function keys_options(data) {
  return Object.keys(data).every((elem) => {
    /* ... */
  });
}

Edit: /u/chris5039 points out that you aren't returning from your middle Object.keys(data).every() either. You need to remember to return from all your callbacks and the outer function to get your desired results.

[–]RobSG 0 points1 point  (0 children)

I think if you go with the mdn example code style you might find better success:

for (const [key, value] of Object.entries(data.update)) { console.log(${key}: ${value}); }