DEV Community

Discussion on: Includes() vs indexOf() in JavaScript

Collapse
 
redeemefy profile image
redeemefy • Edited

I'm wondering about performance. Meaning if includes or indexOf keep searching the array even though already found the element. MDN docs doesn't say if includes breaks the search once finds an element.
developer.mozilla.org/en-US/docs/W...