📌  相关文章
📜  如何在javascript代码示例中检查数组的所有值是否相等

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

代码示例3
// how to check all values of an array are equal or not in javascript
const allEqual = (arr) => arr.every(val => val === arr[0]);
console.log(allEqual([1, 2, 3, 4, 5, 6])); // false
console.log(allEqual([1, 1, 1, 1])); // true