Loading...

Tag: check if an element exists in an array

How to Check If a Value Exists in an Array in JavaScript

You can use the indexOf() method to check if a given element exists in an array or not. The indexOf() method returns the index of the element inside the array if it is found, [ … ]