Array.prototype.includes() determines whether an array includes a certain value, returning true or false as appropriate.

See the Pen thecodelog.com - ES7 Array Methods 1 by Deano (@deangilewicz) on CodePen.

This method handles NaN better than Array.prototype.indexOf(). If the array contains NaN, then indexOf() does not return a correct index while searching for NaN.

See the Pen thecodelog.com - ES7 Array Methods 2 by Deano (@deangilewicz) on CodePen.

leave a reply

Your email address will not be published. Required fields are marked *