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.

البحث
الأقسام
إقرأ المزيد
Apartment Living
The Pros and Cons of Apartment Living: A Modern Lifestyle Choice
Introduction Apartment living has become a popular choice for many, especially in urban areas...
بواسطة Dacey Rankins 2024-10-07 17:33:13 0 19كيلو بايت
Спорт
Убить Билла 1-2. Kill Bill: Vol. 1 - 2. (2003-2004)
Убить Билла 1. Kill Bill: Vol. 1. (2003)В беременную наемную убийцу по кличке Черная Мамба во...
بواسطة Nikolai Pokryshkin 2023-02-23 18:52:53 0 24كيلو بايت
Magazines and E-zines
Exploring the Evolution of News Consumption: Magazines and E-zines
In an age of rapid digital transformation, the way we consume news has undergone a significant...
بواسطة Dacey Rankins 2024-05-06 16:03:45 0 16كيلو بايت
Социальные проблемы
Схватка. Heat. (1995)
Нил МакКоли - один из лучших преступников Лос-Анджелеса. Ему противостоит лучший детектив Винсент...
بواسطة Nikolai Pokryshkin 2023-01-25 08:47:11 0 24كيلو بايت
Future
Future
A future is a hypothetical segment of a timeline, a set of events that have not yet occurred, but...
بواسطة FWhoop Xelqua 2023-03-02 16:16:45 0 19كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov