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.

البحث
الأقسام
إقرأ المزيد
Marketing and Advertising
What Are Common Billboard Advertising Mistakes?
Billboard advertising offers massive visibility, but visibility alone does not guarantee...
بواسطة Dacey Rankins 2026-01-15 17:36:40 0 2كيلو بايت
الهدايا
What to give in the New Year of the Black Rabbit 2023: ideas
The coming year 2023 according to the Eastern calendar will be the year of the Black Water...
بواسطة FWhoop Xelqua 2022-12-20 15:13:11 0 23كيلو بايت
Научная фантастика и фэнтези
Властелин колец: Братство Кольца. The Lord of the Rings: The Fellowship of the Ring. (2001)
Сказания о Средиземье — это хроника Великой войны за Кольцо, длившейся не одну тысячу лет....
بواسطة Nikolai Pokryshkin 2022-11-04 20:07:28 0 43كيلو بايت
Environment
Poison Dart Frogs
Poison dart frog (also known as dart-poison frog, poison frog or formerly known as poison arrow...
بواسطة FWhoop Xelqua 2023-04-23 16:51:05 0 16كيلو بايت
Ethics
Problems of Ethics and Security in the Information System
Information systems have made many businesses successful today. Some companies, such as Google,...
بواسطة Dacey Rankins 2024-03-22 17:56:23 0 26كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov