Personally I find the best way to do this is still the good old if statement:
var value = someArray.indexOf(3);
if (value === -1) {
value = 0;
}
Personally I find the best way to do this is still the good old if statement:
var value = someArray.indexOf(3);
if (value === -1) {
value = 0;
}