JavaScript Map

0
6χλμ.

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.

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Desktop Publishing
Desktop Publishing
Desktop publishing system (NIS) is a set of equipment for preparing the original layout of the...
από FWhoop Xelqua 2023-03-04 17:57:41 0 13χλμ.
Financial Services
Shifts in aggregate supply
Key points The aggregate demand/aggregate supply model is a model that...
από Mark Lorenzo 2023-03-30 19:24:57 0 7χλμ.
Cooking
Only chefs know them: 9 simple tips to make food healthier
If you are thinking about how useful the food that you put on your plate at home is, then you...
από FWhoop Xelqua 2023-05-08 19:24:34 0 16χλμ.
Business
What is Customer Development?
Customer Development is a methodology for creating products or businesses by testing ideas or...
από Dacey Rankins 2025-03-25 15:34:42 0 945
Sport
Senna (2010)
A documentary on Brazilian Formula One racing driver Ayrton Senna, who won the F1 world...
από Leonard Pokrovski 2023-07-04 19:54:58 0 21χλμ.
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov