Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 3
    This is the correct answer. 'some' does exactly what a foreach/break would do. It loops until iteration n = true. Commented Jan 11, 2019 at 16:31
  • 2
    Sonar flags it, not using the returned value from array.some(). The logic is to use it only for looping. Commented Aug 7, 2020 at 19:46
  • 1
    In some ways this is even better than a break, because it's not in general very easy to determine whether or not one "broke" from the loop without employing an additional flag. Commented Aug 2, 2024 at 2:08