JavaScript Map

0
12KB

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.

Suche
Kategorien
Mehr lesen
Business
How Do I Qualify a Sales Lead?
Qualifying sales leads is one of the most important — and most overlooked — skills in...
Von Dacey Rankins 2025-12-16 22:47:41 0 4KB
Business
What Are the Biggest Prospecting Mistakes?
Prospecting is simple — but not easy.Most people don’t struggle because they lack...
Von Dacey Rankins 2025-12-09 18:26:06 0 4KB
Marketing and Advertising
How Much Money Can I Make with Affiliate Marketing? Is It Profitable?
Affiliate marketing is often hyped as one of the easiest ways to earn passive income online....
Von Dacey Rankins 2025-09-18 16:09:05 0 6KB
Television
His Channel. Live TV. Santa Ana, California, USA
His Channel or The Conservative Christian Network is based in Santa Ana, California. Programming...
Von Nikolai Pokryshkin 2022-09-27 08:20:04 0 40KB
Business
How Does a Startup Incubator Work?
In today’s fast-paced entrepreneurial ecosystem, startup incubators play a vital role in...
Von Dacey Rankins 2025-04-24 16:52:09 0 16KB

BigMoney.VIP Powered by Hosting Pokrov