JavaScript Map

0
13χλμ.

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.

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Business
What Is a Disruptive Business Model?
Most industries do not collapse dramatically. They erode gradually. At first, the dominant...
από Dacey Rankins 2026-05-13 13:23:53 0 2χλμ.
Business and Corporate Finance
What Financial Reports Does a CFO Oversee?
What Financial Reports Does a CFO Oversee?P&L, Balance Sheet, Cash Flow, and Forecasts The...
από Leonard Pokrovski 2026-01-14 16:20:00 0 6χλμ.
Научная фантастика и фэнтези
Властелин колец: Братство Кольца. The Lord of the Rings: The Fellowship of the Ring. (2001)
Сказания о Средиземье — это хроника Великой войны за Кольцо, длившейся не одну тысячу лет....
από Nikolai Pokryshkin 2022-11-04 20:07:28 0 50χλμ.
Marketing and Advertising
Do I Need to Hire a PR Firm or Can I DIY? A Complete Guide for Modern Businesses
Introduction: The PR Dilemma for Businesses Every business, whether a startup or a global...
από Dacey Rankins 2025-10-27 17:15:35 0 11χλμ.
Business
What Are the Most Common Funding Sources for Startups?
Securing funding is one of the most challenging and essential steps in launching a startup. As a...
από Dacey Rankins 2025-04-02 16:29:15 0 13χλμ.

BigMoney.VIP Powered by Hosting Pokrov