Array.prototype.findbeginnerconst nums = [3, 7, 12, 5]
nums.find(n => n > 10) // β 12 (first match)Use find() to get the first element that satisfies a condition, or undefined if none does.
Array.prototype.find(callback) returns the first element for which the callback returns a truthy value, or undefined if no element matches. It short-circuits on the first match.
Challenge: Implement findFirst(nums, min) that returns the first number >= min.
findFirst([1, 5, 3, 10], 5) // β 5
findFirst([1, 2, 3], 10) // β undefined