What is the briefest and proficient approach to see whether a JavaScript array contains a value?
This is the lone way I know to do it:
function contains(a, obj) {
for (var i = 0; i < a.length; i++) {
if (a[i] === obj) {
return true;
}
}
return false;
}
Is there a superior and more compact approach to achieve this?