Created
November 8, 2024 08:38
-
-
Save X-Raym/1e9ee4c50791ed067640ced22371ae6f to your computer and use it in GitHub Desktop.
String to array of unique characters JavaScript
This file contains 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
function StrToUniqueCharactersArr(str) { | |
str = str.split("") // Array of chars from str | |
let set = new Set(str) // Set of unique values from array | |
return [...set] // Convert set to array | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment