- Either use
Array.indexOf(Object)
. - With ECMA 7 one can use the
Array.includes(Object)
. With ECMA 6 you can use
Array.find(FunctionName)
whereFunctionName
is a user defined function to search for the object in the array.Hope this helps!
↧
Answer by Krishna Ganeriwal for How do I check if an array includes a value in JavaScript?
↧