How does js determine whether a value at the end of an array is false?

test= [
  {
    "id": 1,
    "name": "Safa",
    "email": "neerupeeru@mail.ee",
    "purpose": "thesis",
    "programme": "Software Engineering",
    "year": 2016,
    "language": "Estonian",
    "comments": "In need of correcting a dangling participle.",
    "status": true
  },
  {
    "id": 2,
    "name": "Safa",
    "email": "neerupeeru@mail.ee",
    "purpose": "thesis",
    "programme": "Software Engineering",
    "year": 2016,
    "language": "Estonian",
    "comments": "In need of correcting a dangling participle.",
    "status": false
  },
  {
    "id": 3,
    "name": "Salman",
    "email": "neerupeeru@mail.ee",
    "purpose": "thesis",
    "programme": "Software Engineering",
    "year": 2016,
    "language": "Estonian",
    "comments": "In need of correcting a dangling participle.",
    "status": true
  }
];

I want to judge that the next status is false, then do something

for example, if the loop runs to the first, and then finds that the status of the next object is false, then console.log ("next is false")

the card cannot catch the next status

how do I implement it?

Apr.21,2022

as you said, look at the next one in a loop. This code is pretty straightforward, isn't it?

for (const i = 0;i < test.length;iPP) {
  if (i + 1 < test.length && !test[i + 1].status) console.log("false")
}
Menu