DEV Community

loading...

Discussion on: How to compare two arrays in javascript?

Collapse
pretaporter profile image
Maksim

You can make a bit improvement

botType.indexOf(item) > 1 => botType.includes(item)
Enter fullscreen mode Exit fullscreen mode
Collapse
stereobooster profile image
stereobooster • Edited

This will make code work, but it is O(n^2) (the same as the original code)