JS
…

Module 1 of 2

sets

Create sets, add and delete values, and run union-style operations.

Sets & Maps · 0/7 completed · scroll down for every challenge

Challenge 1 of 7

Create a set

Instructions

Create `tags` as a Set containing `"js"` and `"css"`.

Editor

IntelliSense on

// Write your code below

Challenge 2 of 7 · Has value

Challenge 2 of 7

Has value

Instructions

Write `hasValue(set, value)` that returns whether the set contains value.

Editor

IntelliSense on

// Write your code below

Challenge 3 of 7 · Add values

Challenge 3 of 7

Add values

Instructions

Write `addAll(set, values)` that adds every item from the array and returns the set.

Editor

IntelliSense on

// Write your code below

Challenge 4 of 7 · Delete value

Challenge 4 of 7

Delete value

Instructions

Write `removeValue(set, value)` that deletes the value and returns the set.

Editor

IntelliSense on

// Write your code below

Challenge 5 of 7 · Set to array

Challenge 5 of 7

Set to array

Instructions

Write `toArray(set)` that returns an array of set values.

Editor

IntelliSense on

// Write your code below

Challenge 6 of 7 · Union

Challenge 6 of 7

Union

Instructions

Write `union(a, b)` returning a new Set of values in either set.

Editor

IntelliSense on

// Write your code below

Challenge 7 of 7 · Intersection

Challenge 7 of 7

Intersection

Instructions

Write `intersection(a, b)` returning values present in both sets.

Editor

IntelliSense on

// Write your code below

Next module