📅  最后修改于: 2022-03-11 15:02:38.561000             🧑  作者: Mango
// 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