JavaScript Array includes() Method
Array.includes() is a method that checks if an element is present in an array, returning boolean value, true if found, false otherwise.
Syntax:
array.includes(searchElement, start)
Example: In this example we are using array includes to find specific element on our given array.
Javascript
let languages = [ 'HTML' , 'CSS' , 'JavaScript' , 'React.js' ]; let search1 = 'HTML' ; let search2 = 'Node.js' ; console.log(languages.includes(search1)); console.log(languages.includes(search2)); |
true false
JS 2016 or ECMAScript 2016
JavaScript 2016 (ES2016) is a modified version of ES2015 in which they introduced some new features like JavaScript Exponentiation (**) operator, JavaScript Exponentiation assignment (**=), and Array..includes() method for array element presence checking, enhancing calculations, and array operations, JavaScript 2016 is also known as ECMAScript 2016.