JavaScript Map

0
12χλμ.

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.

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Mental Health
Autism Spectrum: Pharmacological interventions
Medications may be used to treat ASD symptoms that interfere with integrating a child into home...
από Kelsey Rodriguez 2023-03-16 18:00:28 0 12χλμ.
Business
What Is Preventive Maintenance in Facility Management?
Preventive maintenance is a fundamental concept in facility management that focuses on...
από Dacey Rankins 2026-04-16 15:27:39 0 138
Contests
The Exciting World of Art Contests: Fostering Creativity and Talent
Art contests have long been a significant part of the creative landscape, providing artists of...
από Dacey Rankins 2024-12-12 14:28:33 0 11χλμ.
Hospitality
The Future of Hospitality: Trends and Innovations Shaping the Industry in 2024
The hospitality industry is one of the most dynamic sectors of the global economy, constantly...
από Dacey Rankins 2024-11-06 18:06:56 0 13χλμ.
Clothing
10 Tips for Successfully Buying Clothes Online
More than 50% of purchases are now made online. This is beneficial for everyone: shop owners may...
από FWhoop Xelqua 2022-09-22 13:56:43 0 48χλμ.

BigMoney.VIP Powered by Hosting Pokrov