Reference Some

  • Returns a boolean response if a value in the arrays meets the criteria.
  • Once matched found it returns true and stops iterating through the array.
  • W3Schools Documentation Array Some

Example - id 28 Exists
WDS Video on this Hook
fetch("https://jsonplaceholder.typicode.com/todos") .then((response) => response.json()) .then((todos) => { let matched = false; matched = todos.some((t) => t.id === 28); console.log(todos, matched); });