Fix typos, 07-map-set-weakmap-weakset

This commit is contained in:
Georgy 2017-10-02 14:29:44 -04:00 committed by GitHub
parent 121c264090
commit 2be0ffd289

View file

@ -16,7 +16,7 @@ The main methods are:
- `new Map()` -- creates the map. - `new Map()` -- creates the map.
- `map.set(key, value)` -- stores the value by the key. - `map.set(key, value)` -- stores the value by the key.
- `map.get(key)` -- returns the value by the key. - `map.get(key)` -- returns the value by the key, `undefined` if `key` doesn't exist in map.
- `map.has(key)` -- returns `true` if the `key` exists, `false` otherwise. - `map.has(key)` -- returns `true` if the `key` exists, `false` otherwise.
- `map.delete(key)` -- removes the value by the key. - `map.delete(key)` -- removes the value by the key.
- `map.clear()` -- clears the map - `map.clear()` -- clears the map
@ -148,7 +148,7 @@ for(let amount of recipeMap.values()) {
// iterate over [key, value] entries // iterate over [key, value] entries
for(let entry of recipeMap) { // the same as of recipeMap.entries() for(let entry of recipeMap) { // the same as of recipeMap.entries()
alert(entry); // cucumber,50 (and so on) alert(entry); // cucumber,500 (and so on)
} }
``` ```
@ -160,7 +160,7 @@ Besides that, `Map` has a built-in `forEach` method, similar to `Array`:
```js ```js
recipeMap.forEach( (value, key, map) => { recipeMap.forEach( (value, key, map) => {
alert(`${key}: ${value}`); // cucumber: 50 etc alert(`${key}: ${value}`); // cucumber: 500 etc
}); });
``` ```