📌  相关文章
📜  检查数组是否不包含值 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:16.511000             🧑  作者: Mango

代码示例3
const fruits = ['apple', 'banana', 'mango', 'guava'];

function checkAvailability(arr, val) {
  return arr.some(arrVal => val === arrVal);
}

checkAvailability(fruits, 'kela');   // false
checkAvailability(fruits, 'banana'); // true