JavaScript Map

0
5K

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.

Cerca
Categorie
Leggi tutto
Television
FOX Weather Live TV USA
Streaming 24/7 from America's Weather Center.Fox Weather is a digital broadcast television...
By Nikolai Pokryshkin 2022-09-05 08:52:17 0 20K
Научная фантастика и фэнтези
Мстители: Война бесконечности. Avengers: Infinity War. (2018)
Пока Мстители и их союзники продолжают защищать мир от различных опасностей, с которыми не смог...
By Nikolai Pokryshkin 2022-12-17 20:45:04 0 26K
Graphics
Neural networks for the designer: the best services with AI to simplify the work
Neural networks are a powerful tool that can help designers improve the efficiency and quality of...
By FWhoop Xelqua 2023-06-15 20:11:05 0 23K
Телевидение
Башкортостан 24. Прямая трансляция телеканала.
Телеканал «Башкортостан 24» создан в 2016 году в соответствии с Указом Президента...
By Nikolai Pokryshkin 2022-11-15 19:41:48 0 16K
Programming
Reddit API Pricing
Reddit began shutting down some third-party apps after weeks of outrage over its API pricing...
By Jesse Thomas 2023-07-10 23:45:44 0 5K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov