Map & Set
11 min
JavaScript 100 Days
Map aur Set ES6 ke naye data structures hain. Map key-value pairs store karta hai lekin keys koi bhi type ho sakti hai (object bhi!). Set unique values ka collection hai — duplicates automatically remove ho jaate hain.
Map — Any Key Type
Map mein objects, functions bhi keys ho sakti hain. Order maintain hota hai. Size property hai.
Set — Unique Values
Set mein duplicate values automatically ignore hoti hain. Array se duplicates remove karne ka best way.
🎯 Practice Challenge
Users array hai with duplicate emails. Set use karke unique emails nikalo. Map use karke user data ko email key se store karo.