Array.prototype.someintermediateconst arr = [1, 2, 3, 4, 5]
arr.some(n => { console.log(n); return n === 3 })
// logs 1, 2, 3 β stops earlysome() short-circuits as soon as a truthy result is found, saving unnecessary iterations.
some() is ideal for detecting duplicates: check whether any element appears at a different index than its first occurrence using indexOf.
Challenge: Implement containsDuplicate(arr) that returns true if any element appears more than once.
containsDuplicate([1, 2, 3, 2]) // β true
containsDuplicate([1, 2, 3]) // β false