JavaScript Map

0
11كيلو بايت

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.

البحث
الأقسام
إقرأ المزيد
Personal Organization
Social work
Social work with the elderly in the UNITED STATES In the United States, the implementation of...
بواسطة FWhoop Xelqua 2023-01-21 17:55:34 0 23كيلو بايت
Current Events
Happy New Year - featuring new year photos
New years in London! An amazing lightshow, just in line with the wheel!   ...
بواسطة FWhoop Xelqua 2023-01-01 18:13:25 0 25كيلو بايت
Kites
Soaring Through Time: The Art of Recreating Kites
Soaring Through Time: The Art of Recreating Kites From the serene flight of a bird-shaped kite...
بواسطة Leonard Pokrovski 2024-05-11 18:10:30 0 16كيلو بايت
Personal Finance
How Salary Is Calculated: A Practical Guide to Hourly Pay, Salaried Pay, Overtime, and Job Classification
How Salary Is Calculated: A Practical Guide to Hourly Pay, Salaried Pay, Overtime, and Job...
بواسطة Leonard Pokrovski 2025-11-28 21:18:04 0 1كيلو بايت
Hand-Eye Coordination
Game: Coordination Challenge
Objective: The goal is to complete various mini-challenges inspired by popular games that...
بواسطة Dacey Rankins 2024-10-08 19:50:13 0 15كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov