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.

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Information Technology
History of Information Technology
The history of information technology dates back to long before the emergence of the modern...
από Dacey Rankins 2024-03-13 17:35:53 0 33χλμ.
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 5χλμ.
Business
What Is Product Management?
Product management is a discipline focused on guiding the development, launch, and growth of...
από Dacey Rankins 2025-08-15 20:31:22 0 6χλμ.
Business
When Is Mentoring or Coaching Appropriate? Knowing the Right Time for Each
Professional development isn’t one-size-fits-all. Depending on your goals, you may benefit...
από Dacey Rankins 2025-07-08 13:49:26 0 6χλμ.
Customer Service
How Do You Communicate Effectively With Customers?
Effective communication is one of the most important elements of successful customer service....
από Dacey Rankins 2026-03-10 19:39:49 0 4χλμ.

BigMoney.VIP Powered by Hosting Pokrov