includes(). Follow along as I go over this method and show you how to use it!
First things first, what is
includes() method determines whether an array includes a certain value among its entries, returning
false as appropriate.
MDN – includes() documentation
Consider the following array:
const names = ['jamie', 'kandra', 'taylor'];
If we wanted to check to see if the string ‘bob’ was in this array, we would just write this:
names.includes('bob'); //expected output: false
Now, let’s check if the string “kandra” is included in our
names.includes('kandra'); //expected output: true
Here are some other helpful resources:
MDN Documentation for