Skip to content

Instantly share code, notes, and snippets.

@OlegKorn
Created October 20, 2022 04:35
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 OlegKorn/42c0b03a0b84abd5c39178335f0944a8 to your computer and use it in GitHub Desktop.
Save OlegKorn/42c0b03a0b84abd5c39178335f0944a8 to your computer and use it in GitHub Desktop.
JS - check if all chars of string are same
s = "bbbb"
const arr = [...s]
const allEqual = arr => arr.every(val => val === arr[0])
if (allEqual(arr) {
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment