Complete the code to find the first number greater than 10 in the array.
const numbers = [4, 9, 15, 7]; const result = numbers.[1](num => num > 10);
The find method returns the first element that satisfies the condition.
Complete the code to check if some numbers in the array are even.
const numbers = [1, 3, 5, 6]; const hasEven = numbers.[1](num => num % 2 === 0);
The some method returns true if at least one element meets the condition.
Fix the error in the code to find the first string longer than 3 characters.
const words = ['cat', 'dog', 'bird']; const longWord = words.[1](word => word.length > 3);
find returns the first element matching the condition, which is what we want here.
Fill both blanks to create an array of words longer than 4 characters using filter and check if some words start with 'a'.
const words = ['apple', 'bat', 'anchor', 'cat']; const longWords = words.[1](word => word.length > 4); const hasAStart = words.[2](word => word.startsWith('a'));
filter creates a new array with words longer than 4 characters.some checks if any word starts with 'a'.
Fill all three blanks to find the first number divisible by 3, check if some numbers are negative, and filter numbers greater than 5.
const nums = [2, -3, 6, 8]; const firstDiv3 = nums.[1](num => num % 3 === 0); const hasNegative = nums.[2](num => num < 0); const greaterThan5 = nums.[3](num => num > 5);
find returns the first number divisible by 3.some checks if any number is negative.filter creates an array of numbers greater than 5.