Check For The Presence of an Element With indexOf()

function quickCheck(arr, elem) {
// Only change code below this line
let value = arr.indexOf(elem);
if(value >= 0){
return true;
}else{
return false;
}
// Only change code above this line
}

console.log(quickCheck([‘squash’, ‘onions’, ‘shallots’], ‘mushrooms’));

Hi there, I can see the code but not question. Please, elaborate what issues you are having with this code. Thanks!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.