Tsallaka zuwa abun ciki
Justice Tech School

Finding Items in Arrays

find returns the first match, findIndex its position, includes tests presence, some and every test conditions and indexOf finds a position.

Example
const n = [5, 12, 8, 130, 44];
console.log(n.find((x) => x > 10), n.findIndex((x) => x > 10));
console.log(n.includes(8), n.some((x) => x > 100), n.every((x) => x > 1));

Exercise

First matching item.

n.((x) => x > 10)

Quiz Test

What does every() return?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.