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.

البحث
الأقسام
إقرأ المزيد
Business and Corporate Finance
What Is Profit vs. Revenue?
What Is Profit vs. Revenue? When people talk about business success, two words come up again and...
بواسطة Leonard Pokrovski 2026-01-07 07:32:34 0 1كيلو بايت
Marketing and Advertising
Best Practices for Effective Email Marketing in 2023 (and Beyond)
Introduction Email marketing is one of the most reliable and profitable digital marketing...
بواسطة Dacey Rankins 2025-10-03 20:40:07 0 5كيلو بايت
Programming
Why You Should Learn Python First
Python is known as beginner friendly for the basics. It is easily understandable once they know...
بواسطة Jesse Thomas 2023-02-17 22:57:51 0 12كيلو بايت
Business
What Are Communication Skills?
Introduction Communication skills represent one of the most essential human capabilities,...
بواسطة Dacey Rankins 2025-11-20 15:08:55 0 2كيلو بايت
Business
What Are Performance Indicators (KPIs)?
In business management, one phrase that appears constantly in conversations about success and...
بواسطة Dacey Rankins 2025-08-27 15:06:43 0 5كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov