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.

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Business
Is Viral Growth Always Desirable?
Viral growth is one of the most exciting concepts in business and marketing. The idea that your...
από Dacey Rankins 2025-09-17 10:53:01 0 15χλμ.
Business
How Do Time Spans Affect Our Understanding of Growth?
Growth is not a single, uniform process. Its meaning and significance shift dramatically...
από Dacey Rankins 2025-09-09 14:28:17 0 8χλμ.
Petanque
Discovering the Charm of Petanque: A Closer Look at the French Game of Precision
In the realm of leisurely yet competitive sports, few embody the spirit of relaxation and...
από Dacey Rankins 2024-07-04 16:05:35 0 20χλμ.
Economics
Should governments regulate free markets?
Should Governments Regulate Free Markets? The Argument That Never Goes Away Walk into any...
από Leonard Pokrovski 2026-06-04 23:40:33 0 5χλμ.
Marketing and Advertising
What Is the Difference Between User Acquisition and Lead Generation?
At first glance, user acquisition and lead generation may seem similar. Both involve attracting...
από Dacey Rankins 2026-02-27 18:37:13 0 5χλμ.

BigMoney.VIP Powered by Hosting Pokrov