What is the quickest and most effective method to determine whether a JavaScript array has a value?
The only method I am aware of is as follows:
function contains(a, obj) {
for (var i = 0; i < a.length; i++) {
if (a[i] === obj) {
return true;
}
}
return false;
}
Is there a better and more concise way to accomplish this?