You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/05-data-types/07-map-set/article.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,13 @@ But that's not enough for real life. That's why `Map` and `Set` also exist.
14
14
15
15
Methods and properties are:
16
16
17
-
-[`new Map()`](mdn:js/Map/Map) -- creates the map.
18
-
-[`map.set(key, value)`](mdn:js/Map/set) -- stores the value by the key.
19
-
-[`map.get(key)`](mdn:js/Map/get) -- returns the value by the key, `undefined` if `key` doesn't exist in map.
20
-
-[`map.has(key)`](mdn:js/Map/has) -- returns `true` if the `key` exists, `false` otherwise.
21
-
-[`map.delete(key)`](mdn:js/Map/delete) -- removes the value by the key.
22
-
-[`map.clear()`](mdn:js/Map/clear) -- removes everything from the map.
23
-
-[`map.size`](mdn:js/Map/size) -- returns the current element count.
17
+
-[`new Map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/Map) -- creates the map.
18
+
-[`map.set(key, value)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set) -- stores the value by the key.
19
+
-[`map.get(key)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) -- returns the value by the key, `undefined` if `key` doesn't exist in map.
20
+
-[`map.has(key)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has) -- returns `true` if the `key` exists, `false` otherwise.
21
+
-[`map.delete(key)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete) -- removes the value by the key.
22
+
-[`map.clear()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear) -- removes everything from the map.
23
+
-[`map.size`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size) -- returns the current element count.
24
24
25
25
For instance:
26
26
@@ -104,9 +104,9 @@ map.set('1', 'str1')
104
104
105
105
For looping over a `map`, there are 3 methods:
106
106
107
-
- [`map.keys()`](mdn:js/Map/keys) -- returns an iterable for keys,
108
-
- [`map.values()`](mdn:js/Map/values) -- returns an iterable for values,
109
-
- [`map.entries()`](mdn:js/Map/entries) -- returns an iterable for entries `[key, value]`, it's used by default in `for..of`.
107
+
- [`map.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys) -- returns an iterable for keys,
108
+
- [`map.values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values) -- returns an iterable for values,
109
+
- [`map.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries) -- returns an iterable for entries `[key, value]`, it's used by default in `for..of`.
110
110
111
111
For instance:
112
112
@@ -232,7 +232,7 @@ That's the same, because `Object.fromEntries` expects an iterable object as the
232
232
233
233
## Set
234
234
235
-
A [`Set`](mdn:js/Set) is a special type collection - "set of values" (without keys), where each value may occur only once.
235
+
A [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) is a special type collection - "set of values" (without keys), where each value may occur only once.
0 commit comments