JavaScript Map

0
9KB

Map objects are collections of key-value pairs. A key in the Map may only occur once; it is unique in the Map's collection. A Map object is iterated by key-value pairs — a for...of loop returns a 2-member array of [key, value] for each iteration. Iteration happens in insertion order, which corresponds to the order in which each key-value pair was first inserted into the map by the set() method (that is, there wasn't a key with the same value already in the map when set() was called).

The specification requires maps to be implemented "that, on average, provide access times that are sublinear on the number of elements in the collection". Therefore, it could be represented internally as a hash table (with O(1) lookup), a search tree (with O(log(N)) lookup), or any other data structure, as long as the complexity is better than O(N).

Key equality

Value equality is based on the SameValueZero algorithm. (It used to use SameValue, which treated 0 and -0 as different. Check browser compatibility.) This means NaN is considered the same as NaN (even though NaN !== NaN) and all other values are considered equal according to the semantics of the === operator.

Pesquisar
Categorias
Leia mais
Television
NRG. Music Live TV.
NRG is a modern music TV chanel in Larissa motivated by passion and love for foreign music.NRG's...
Por Nikolai Pokryshkin 2022-11-03 14:44:14 0 23KB
Business
How Startups Can Validate Their Business Ideas
For startups, one of the most crucial steps before launching a product or service is validating...
Por Dacey Rankins 2025-03-21 14:09:25 0 8KB
Business
What Are the Benefits of Intrapreneurship for Organizations?
In a rapidly evolving business landscape, companies must consistently innovate to stay relevant...
Por Dacey Rankins 2025-04-17 12:49:09 0 5KB
Social Issues
Calm with Horses.(2020)
Douglas 'Arm' Armstrong has become the feared enforcer for the drug-dealing Devers family, whilst...
Por Leonard Pokrovski 2022-10-27 22:11:43 0 24KB
Социальные проблемы
Жизнь прекрасна. Life Is Beautiful. (1997)
Во время Второй мировой войны из Италии в концлагерь были отправлены евреи - отец с маленьким...
Por Nikolai Pokryshkin 2022-11-19 16:37:39 0 26KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov