Easy forget indexOf return a number, not a boolean
- exist -> return the first index of the element
- not exist -> return -1
// if exist
if(arr.indexOf('something' !== -1)){
}else{
// if not exist
}
the code above is equal to below
if(~arr.indexOf('something')){
}else{
}