Created
December 6, 2025 16:06
-
-
Save davidystephenson/660cb858d4a0506a1eb24bc94527fbdb 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
| const grades = ['a', 'a', 'b', 'a', 'd', 'a', 'b'] | |
| const uniqueGrades = new Set(grades) | |
| console.log('uniqueGrades', uniqueGrades) | |
| const uniqueGradesArray = [...uniqueGrades] | |
| console.log('uniqueGradesArray', uniqueGradesArray) | |
| const set = new Set() | |
| set.add(1) | |
| set.add('hello') | |
| set.add(true) | |
| console.log('initial set', set) | |
| set.add(1) | |
| set.add(1) | |
| set.add(1) | |
| set.add(2) | |
| set.delete('hello') | |
| console.log('final set', set) | |
| const hasOne = set.has(1) | |
| const hasFive = set.has(5) | |
| console.log('hasOne', hasOne) | |
| console.log('hasFive', hasFive) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment