JavaScript Map

0
5K

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
Life Issues
The Truman Show. (1998)
An insurance salesman discovers his whole life is actually a reality TV show. My Link
Por Leonard Pokrovski 2023-02-12 17:03:11 0 11K
Телевидение
TV BRICS международная сеть. Прямая трансляция. Россия. Русский, Китайский. 电视金砖国际网络。 现场直播。 俄罗斯。 俄文,中文。
Российский телеканал TV BRICS транслируемый в Китае. Потенциальная аудитория 150 млн человек....
Por Nikolai Pokryshkin 2022-11-28 19:51:56 0 20K
Supercomputing
Supercomputing: Unleashing the Power of Advanced Computing
Supercomputing represents the pinnacle of computational capability, enabling researchers and...
Por Dacey Rankins 2024-10-21 16:45:44 0 4K
Социальные проблемы
Большой куш. Snatch. (2000)
Фрэнки Четыре Пальца должен был переправить краденый алмаз из Англии в США своему боссу Эви, но,...
Por Nikolai Pokryshkin 2023-01-31 12:31:53 0 18K
Mental Health
Psychosis: Negative symptoms and Psychosis in adolescents
Negative symptoms Negative symptoms include reduced emotional expression (flat affect),...
Por Kelsey Rodriguez 2023-05-17 15:13:50 0 4K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov