WEB PERFORMANCE
Should You Use .includes or .filter to Check if An Array Contains an Item?
Either method can work. Array.prototype.filter()
is infinitely more powerful than Array.prototype.includes()
, while the .includes()
method is easier to read and offers much better performance.
Published in
8 min readMar 11, 2021