Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (13.1k points)
Can anyone help me help me what is the best way to find if the object is in an array or not in JavaScript?

1 Answer

0 votes
by (26.7k points)

Basically, you can use includes() function to find:


Also, for other older browsers, you can try the below code:

function include(arr,obj) {

    return (arr.indexOf(obj) != -1);


I hope this will help.

Want to become a Java Expert? join Java Training now!!

Related questions

Browse Categories