CodingTrain / CodingTrain/Suggestion-Box
ES6 Map and Set objects
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 570
- Forks
- 85
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
When should each be used and what kind of data structures would require using them instead of typical objects or arrays.
* [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
* [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)
As an aside, although this functionality isn't in the native ES6 Map, I particularly like the `.find()` functionality in [this collection that extends the Map class](https://github.com/discordjs/discord.js/blob/a8172951d3d12feb59b8f0c6d77d23837b8f57e3/src/util/Collection.js#L191-L206) where you're able to pass in a key/value pair and get the full object that contains that reference back. This sort of thing I find especially helpful for large nested objects (where a Map is most useful), and it is a fairly simple function to add to a class that extends Map since it's just one small loop to iterate through each item in the Map.
Anyway, I'd love to see a video on Maps, Sets, or other "Collection" types. Especially since these can also play really well into the higher-order functions that were looked at in a few videos recently.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit den verlinkten MDN-Referenzen zu Map und Set und sieh dir die im Issue beschriebenen Beispiele und Anwendungsfälle an. Lege den Umfang des Videos dahingehend fest, wann diese Collections Objekte oder Arrays ersetzen sollten, einschließlich der Frage, ob die vorgeschlagene find-style-Erweiterung abgedeckt ist; abgeschlossen ist die Aufgabe, wenn der angeforderte Lehrinhalt erstellt wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- content
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100