JavaScript has many array methods that can help you solve a variety of problems. One of those methods is the includes() method. The includes() method determines whether an array includes a certain element, returning as a Boolean.


array.includes(includes(findElement[, fromIndex])


  • The element you are looking for in the array.
  • Required
  • The array index of the current element at which to begin searching for the findElement.
  • Optional

Return Value

The return value is a Boolean, which returns true if the value of the element was found, and false if it was not found.

Things to consider

  • If the fromIndex value is negative, the search starts from the index of array.length - fromIndex by asc.
  • If fromIndex is greater than or equal to the length of the array, false is returned. The array will not be searched.


Happy coding!

More Info!

JavaScript docs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store