Skip to content

Instantly share code, notes, and snippets.

@jasp402
Last active August 5, 2020 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasp402/af8070a7f48fe8c092b70d141487cda1 to your computer and use it in GitHub Desktop.
Save jasp402/af8070a7f48fe8c092b70d141487cda1 to your computer and use it in GitHub Desktop.
JS-PackTools | allEqual
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