const myHeroes = ['蝙蝠俠','蜘蛛人','水行俠','黑寡婦']; console.log(myHeroes.indexOf('蟻人')); "沒有找到為-1" -1 console.log(myHeroes.indexOf('水行俠')); // //"索引2就是水行俠:" ,2
const myHeroes = ['蝙蝠俠','蜘蛛人','水行俠','黑寡婦']; console.log(myHeroes.indexOf('蟻人')); "沒有找到為-1" -1 console.log(myHeroes.indexOf('水行俠')); // //"索引2就是水行俠:" ,2