Array.prototype.somebeginnerconst nums = [1, 3, 5, 8]
nums.some(n => n % 2 === 0) // β true (8 is even)Use some() to check whether at least one element satisfies a condition.
Array.prototype.some(predicate) returns true if at least one element satisfies the predicate, false otherwise. It short-circuits as soon as a match is found.
Challenge: Implement hasNegative(nums) that returns true if any number in the array is less than 0.
hasNegative([1, -2, 3]) // β true
hasNegative([1, 2, 3]) // β false