diff --git a/Data Structures/es6SetAdd.js b/Data Structures/es6SetAdd.js new file mode 100644 index 0000000..211191c --- /dev/null +++ b/Data Structures/es6SetAdd.js @@ -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();