728x90
✨ 유일한(unique)값을 얻고 싶을 때 사용할 수 있는 Built-in Object
💻Example Code
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
const strArr = ['a', 'a', 'b', 'b', 'cde', 'cde']; | |
const uniqueValues = new Set(strArr); | |
console.log(uniqueValues); | |
console.log(Array.from(uniqueValues)); |

🧨 중복된 값이 여러 개 존재할 때 유용하게 사용 가능하다.
👉 자세한 내용은 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
'JavaScript > Built-in Method etc.' 카테고리의 다른 글
Array.prototype.splice() (2) | 2020.05.15 |
---|---|
String.prototype.charAt() (0) | 2020.02.22 |
String.prototype.localeCompare() (0) | 2020.02.20 |
Math.round() (0) | 2020.02.16 |
Math.abs() (0) | 2020.01.28 |