In our lib code, we are still using Array#indexOf to determine if an item is existed in array.
For example:
|
this.hostname.indexOf(':') === -1 ? |
|
if (str.indexOf("'") !== -1) { |
For semantics, I think it's more appropriate to move them into Array#includes and it seems no performance difference between them at present: https://jsperf.com/array-indexof-vs-includes.
In our lib code, we are still using
Array#indexOfto determine if an item is existed in array.For example:
node/lib/url.js
Line 584 in 3414bc7
node/lib/internal/util/inspect.js
Line 273 in b05fd4b
For semantics, I think it's more appropriate to move them into
Array#includesand it seems no performance difference between them at present: https://jsperf.com/array-indexof-vs-includes.