Tell us what’s happening:
If I check for solutions here I get the immediate solution.
Could use some help with this one.
Your code so far
function quickCheck(arr, elem) {
// Only change code below this line
if quickCheck.indexOf(arr == [0-9]) { //use the indexoff just like in the example then it compares the array to 0 trough 9. since dates was the only number being postive
return true;
} else {
return false;
}
};
// Only change code above this line
}
console.log(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms'));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36.
Challenge: Check For The Presence of an Element With indexOf()
if (true) {
console.log('always blue, always blue, always blue');
}
if true {
// SyntaxError: Unexpected token
}
// also be mindful that index 0 is a falsy value, so you can't just use the index
if ([1, 2, 3].indexOf(1)) {
console.log('Index 0 is a falsy value so this never runs');
}
if ([1, 2, 3].indexOf(1) >= 0) {
console.log('True index 0 is greater than or equal to 0');
}