
And the simplest way to check primitive values in the array to use the includes() method.As TypeScript is similar to JavaScript, it contains few built-in methods to check whether an array has a particular value or object.As arrays are one of the most used data structures in the IT field, while dealing with a list of array items, users must look for a specific value in the array list.

Rules and Regulations for Array Contains/Includes employeeBoolean3, in which we search for JKL from 4th position, but JKL is in 3rd position, so it returns false. employeeBoolean2, in which we search for JKL from 3rd position, so array includes returns true. So on searching from the 2nd index, JKL is found at 3rd position.

Here, in this example, employeeBoolean1, in which we search for JKL to search from the 2nd index. includes('JKL', 4)ĭocument.write("Boolean value1:", employeeBoolean1 + "") ĭocument.write("Boolean value2:", employeeBoolean2 + "") ĭocument.write("Boolean value3:", employeeBoolean3 + "")
