javascript
Check if all array items are equal javascript
const allEqual = arr => arr.every(v => v === arr[0]);
allEqual([1,1,1,1]); // true
Was this helpful?
Similar Posts
- Get all values as array items from an Object in Javascript
- Assign items of arrays to multiple variable when creating it (Array Destructuring) Javascript(ES6)
- Join array items and convert to string in javascript
- Remove duplicate items from array in Javascript
- Get all values from an array which does not exist in other array Lodash
- Check if given value is an array in Javascript
- Methods to check empty array using javascript