Basically, you can use includes() function to find:
arr.includes(obj);
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!!