JavaScript · Senior · Question 38 of 75

What does new Set([1, 2, 3]).intersection(new Set([2, 3, 4])) return?

Explanation

Since 2024, Set has set-theory methods: union, intersection, difference, symmetricDifference, isSubsetOf and more. Previously this was written by hand with filter. Check target browser support before using it in production.

Further reading

Problem with a question

JavaScript · Senior · question 38

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz