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.

البحث
الأقسام
إقرأ المزيد
Productivity
How to study without procrastinating?
How to Study Without Procrastinating Procrastination is one of the biggest obstacles to...
بواسطة Michael Pokrovski 2026-04-27 20:34:08 0 2كيلو بايت
Personal Finance
How Do I Pay Off Student Loans Faster?
How Do I Pay Off Student Loans Faster? Strategies for Refinancing, Extra Payments, and Smarter...
بواسطة Leonard Pokrovski 2025-12-17 15:58:16 0 12كيلو بايت
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 13كيلو بايت
Television
FOX 6 Live TV. Milwaukee USA.
Milwaukee news, weather, traffic and sports from FOX6, serving southeast Wisconsin. Get breaking...
بواسطة Nikolai Pokryshkin 2022-09-20 08:52:35 0 45كيلو بايت
Business
How Will We Track Progress and Report Performance? Using Gantt, Kanban, Charts, KPIs, Dashboards, and Status Reports
Tracking project progress and reporting performance are essential for keeping teams aligned,...
بواسطة Dacey Rankins 2025-07-14 14:45:38 0 10كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov




google-site-verification=q_0zhvNWwTfwbQ-uEJsvcmUKKbtOWUTgl3H57qDiFrg