-
-
Save elliotlarson/9687381fb96067880612ce8ee4d7ebe2 to your computer and use it in GitHub Desktop.
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
// Creates a new array including the new item, turns it into a Set, | |
// which removes duplicates, and then turns it back to an array | |
const newCharacters = [...new Set([...characters, "Donald"])]; | |
// Since "Donald" is a non-unique item, newCharacters will be: | |
// => ["Walter", "Jeffrey", "Donald"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment