JSchallenger

Get Intersection of two Javascript Sets

Viewed: 125
Attempted: 26
Solved: 6
// Write a function that takes two sets, say setA and setB, as arguments
// Get the intersection of the sets
// In other words, return a set containing all elements that are both in setA as well as setB

function myFunction() {

return
}
Test Cases:
myFunction(new Set([1, 2, 3]), new Set([4, 5, 6]))
Expected
new Set()
myFunction(new Set('12345'), new Set([...'45678']))
Expected
new Set('45')
myFunction(new Set([1, 2, 3]), new Set([2, 3, 4]))
Expected
new Set([2, 3])