js在數組中查找是否存在某一個數值

目前想到的方法有這麼幾個html 1.indexOf()  -> ES5app const array = ['apple', 'banance', 'orange']post array.indexOf('apple')    // 0 存在spa array.indexOf('strawBerry')      // -1不存在   2.find()   -> ES6 const array
相關文章
相關標籤/搜索