Data Structures: Create and Add to Sets in ES6
This commit is contained in:
parent
91f24f96e6
commit
4cf17a7425
12
Data Structures/es6SetAdd.js
Normal file
12
Data Structures/es6SetAdd.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// https://www.freecodecamp.org/learn/coding-interview-prep/data-structures/create-and-add-to-sets-in-es6
|
||||||
|
|
||||||
|
function checkSet() {
|
||||||
|
var set = new Set([1, 2, 3, 3, 2, 1, 2, 3, 1]);
|
||||||
|
// Only change code below this line
|
||||||
|
[1, 2, 3, "Taco", "Cat", "Awesome"].forEach((element) => set.add(element));
|
||||||
|
// Only change code above this line
|
||||||
|
console.log(Array.from(set));
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkSet();
|
Loading…
Reference in New Issue
Block a user