Parameters: This method accepts two parameters as mentioned above and described below:
- searchElement: This parameter holds the element which will be searched.
- start: This parameter is optional and it holds the starting point of the array, where to begin the search the default value is 0.
Return Value: It returns a Boolean value i.e., either True or False.
Below is an example of the Array includes() method.
Example: In this example, we will see if a value is included in an array or not using the Array includes() method.
Example 1: In this example, the method will search for element 2 in that array.
Example 2: In this example, the method will search for the element ‘cat’ in that array and returns false as ‘cat’ is not present in the array.
- Google Chrome 47.0
- Microsoft Edge 14.0
- Mozilla Firefox 43.0
- Safari 9.0
- Opera 34.0
Please Login to comment...