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
How to Start Affiliate Marketing?
The internet has a habit of making affiliate marketing look strangely effortless. Someone...
από Dacey Rankins 2026-05-15 16:18:50 0 668
Ethnic and Regional
The most unusual sweets of the world
Almost all people tend to treat themselves to sweets. Residents of African countries, Japanese...
από FWhoop Xelqua 2022-11-21 13:16:29 0 26χλμ.
Business
What Are Common Mistakes in Product Planning?
Product planning is one of the most critical responsibilities in product management. A strong...
από Dacey Rankins 2025-08-20 15:41:09 0 11χλμ.
Business
How Is Mentoring Different from Coaching?
Mentoring and coaching are both powerful development tools—but they serve different...
από Dacey Rankins 2025-07-18 17:33:08 0 6χλμ.
Productivity
How do video games affect attention and focus?
How Do Video Games Affect Attention and Focus? Video games are one of the most cognitively...
από Michael Pokrovski 2026-04-18 06:55:24 0 6χλμ.

BigMoney.VIP Powered by Hosting Pokrov




google-site-verification=q_0zhvNWwTfwbQ-uEJsvcmUKKbtOWUTgl3H57qDiFrg