C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript TypedArray includes() MethodThe JavaScript Array includes() method is inbuilt function in JavaScript which is used to determine whether a particular element is present in the array or not. This method returns true if the element is present in the array otherwise false.
Syntax:
array.includes(searchElement, start) Parameters:
Search: The element to search for Start: Default 0. At which position start to search. Return value:
It returns a Boolean value, either True or False. Browser Support:
Example 1JavaScript TypedArray includes() Method
<script type="text/javascript">
// JavaScript to illustrate includes() method
// Taking input as an array
var JavaTpoint= [12,24,56,78,2];
a = JavaTpoint.includes(2)
document.write(a);
// expected output: arr[Output:2]
</script>
Output: True Example 2JavaScript TypedArray includes() Method
<script type="text/javascript">
// JavaScript to illustrate includes() method
// Taking input as an array
var JavaTpoint= [12,24,56,78];
a = JavaTpoint.includes(2)
document.write(a);
// expected output: arr[Output:false]
</script>
Output: False
Next TopicJavaScript TypedArray Object
|