Check If Every Value In Array Is Equal

[Solved] Check If Every Value In Array Is Equal | Solidity - Code Explorer | yomemimo.com
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

Answers related to check if every value in array is equal

Code Explorer Popular Question For Solidity