js
setA.intersection(setB)الأصلين مبيتغيّروش. الناتج Set جديد، فتقدر تسلسل عليه union تاني على طول.
البرهان
js
const a = new Set([1, 2, 3]);
const b = new Set([2, 3, 4]);
console.log([...a.intersection(b)]);النتيجة
[ 2, 3 ]