Last active
August 5, 2020 21:53
-
-
Save jasp402/af8070a7f48fe8c092b70d141487cda1 to your computer and use it in GitHub Desktop.
JS-PackTools | allEqual
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {allEqual} = require('js-packtools')(); | |
//ππ» Check if all the elements of an array are equal | |
[1, 1, 1, 1, 1, 1, 1, 1].allEqual(); //β true | |
//ππ» If at least one is different then it returns false | |
[1, 1, 1, 1, 2, 1, 1, 1].allEqual(); //β false | |
//π‘ the same results in a simpler way |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment