You are on page 1of 2

Maps & Sets

Arrays Sets Maps

Store key-value data of any


Store (nested) data of any Store (nested) data of any
kind and length, any key
kind and length kind and length
values are allowed

Iterable, also many special Iterable, also some special Iterable, also some special
array methods available set methods available map methods available

Order is guaranteed,
Order is NOT guaranteed, Order is guaranteed,
duplicates are allowed,
duplicates are NOT allowed, duplicate keys are NOT
zero-based index to access
no index-based access allowed, key-based access
elements
Maps vs Objects

Maps Objects

Can use ANY values (and types) Only may use strings, numbers
as keys or symbols as keys

Better performance for large Perfect for small/ medium-sized


quantities of data sets of data

Better performance when Easier/ quicker to create


adding + removing data (typically also with better
frequently performance)

You might also like