JavaScript · Senior · Question 46 of 75
What does [1, 2, 3, 4].findLast(n => n % 2 === 1) return?
- ✓Correct answer:
3 - 2
1 - 3
[1, 3]
Explanation
findLast and findLastIndex (ES2023) search from the end of the array - without reverse, which mutates the array. For multiple matches, use filter.