JavaScript Map

0
13χλμ.

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.

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Productivity
What is focus?
What Is Focus? Focus is one of the most fundamental yet misunderstood cognitive abilities. In...
από Michael Pokrovski 2026-04-18 07:00:55 0 3χλμ.
Human Resources
What Qualifications Are Needed for Customer Service Jobs?
Customer service plays a critical role in modern organizations because it directly influences...
από Dacey Rankins 2026-03-14 01:00:47 0 7χλμ.
Business
What Is the Difference Between SaaS, PaaS, and IaaS? Understanding the Three Layers of Cloud Computing
Every technology revolution creates a new vocabulary. Some terms disappear quickly. Others...
από Dacey Rankins 2026-07-24 21:29:13 0 1χλμ.
Телевидение
Телеканал ТРК Братск, прямой эфир.
Телевидение города Братск, Иркутской области. Правопреемница еще советской студии...
από Nikolai Pokryshkin 2022-10-22 11:49:09 0 32χλμ.
Life Issues
Monsters, Inc. (2001)
In order to power the city, monsters have to scare children so that they scream. However, the...
από Leonard Pokrovski 2023-04-09 18:48:30 0 30χλμ.

BigMoney.VIP Powered by Hosting Pokrov