Created
October 20, 2022 04:35
-
-
Save OlegKorn/42c0b03a0b84abd5c39178335f0944a8 to your computer and use it in GitHub Desktop.
JS - check if all chars of string are same
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
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