I’m trying to get comfortable with all the array methods. Why doesn’t this code work? I’ve tried without === true
, !com[i].indexOf(), and tried putting conditionals in an else if statement.
let str = ['a', 'z'];
let com = 'abcdefgh'
console.log(str)
console.log(com)
for(let i = 0; i < com.length; i++) {
if(com[i].indexOf(str) === true) {
console.log(true)
}
else {
console.log(false)
}
}