Tell us what’s happening:
I followed the solution for this but i want to further my grasp of the solution, can someone explain the syntax of the solution in detail as i have a general idea as to what’s going on but any additonal information would help.
Your code so far
function quickCheck(arr, elem) {
// change code below this line
return arr.indexOf(elem)=== -1 ? false : true;
// change code above this line
}
// change code here to test different cases:
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/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof