In this video CJ talks about the scenarios when it is better to use Maps and Sets instead of Objects and Arrays in JavaScript.
00:00 Intro
01:09 The problem with Objects
02:41 When to use a Map
03:07 How to use Map
04:34 Create a Map from an Object
04:59 Object Keys are Strings
05:59 Create a Map from an Array
07:02 Map methods are nice
07:45 JSON.stringify a Map
08:53 Sets
09:15 The problem with Array.includes
10:36 Making a Set with an Object
11:50 Create a Set from an Array
12:23 Sets and Duplicate Values
12:58 Set methods on MDN
13:21 Thanks for watching
Listen to episode 689 on Syntax: syntax.fm/show/689/you-should...
Read about Map on MDN: developer.mozilla.org/en-US/d...
Read about Set on MDN: developer.mozilla.org/en-US/d...
------------------------------------------------------------------------------
Hit us up on Socials!
www.syntax.fm/links
Brought to you by Sentry, use code tastytreats to get your first 2 months free: sentry.io/syntax/
#javascript #webdevelopment #programming #typescript
Негізгі бет Ғылым және технология You Should Use Maps and Sets in JS
Пікірлер: 29