Question : check if every value in array is equal
Answered by : wideeyed-willet-4jv8rt9r62ka
const allEqual = arr => arr.every( v => v === arr[0] )
allEqual( [1,1,1,1] ) // true
Source : https://stackoverflow.com/questions/14832603/check-if-all-values-of-array-are-equal | Last Update : Tue, 22 Mar 22
Question : check if all array elements are equal
Answered by : shirshak
function myFunction( arr ) { return new Set(arr).size === 1
}
Source : | Last Update : Fri, 01 Apr 22