![This feature is about identifying capture groups via names. // Without named capture groups const re = /(\d{4})-(\d{2})-(\d{2})/; const match = re.exec('2021-03-04'); console.log(match[1]); // → 2021 (year) console.log(match[2]); // → 03 (month) console.log(match[3]); // → 04 (day) // With named capture groups 🔥 const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2021-03-04'); console.log(match.groups.year); // → 2021 console.log(match.groups.month); // → 03 console.log(match.groups.day); // → 04 // ... and with destructuring assignment 🔥🔥🔥 const [match, year, month, day] = re.exec('2021-03-04');](https://pbs.twimg.com/media/EzwqDp7VgAAQQnZ.jpg?name=small&format=webp)
ALT This feature is about identifying capture groups via names. // Without named capture groups const re = /(\d{4})-(\d{2})-(\d{2})/; const match = re.exec('2021-03-04'); console.log(match[1]); // → 2021 (year) console.log(match[2]); // → 03 (month) console.log(match[3]); // → 04 (day) // With named capture groups 🔥 const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2021-03-04'); console.log(match.groups.year); // → 2021 console.log(match.groups.month); // → 03 console.log(match.groups.day); // → 04 // ... and with destructuring assignment 🔥🔥🔥 const [match, year, month, day] = re.exec('2021-03-04');
![// Array.of will take all it's arguments and turn it into an array Array.of('Hey', 5, '🔥', '💩'); → ["Hey", 5, "🔥", "💩"] // Array.from() will take anything that is array-ish / iterable and turn it into a legit array Array.from({ length: 5 }); // a length property is array-like → [undefined, undefined, undefined, undefined, undefined] Array.from({ length: 5 }, x => '💩'); // Array.from also can also take a map](https://pbs.twimg.com/media/DGtkd4uVYAEvQq3.jpg?name=small&format=webp)
ALT // Array.of will take all it's arguments and turn it into an array Array.of('Hey', 5, '🔥', '💩'); → ["Hey", 5, "🔥", "💩"] // Array.from() will take anything that is array-ish / iterable and turn it into a legit array Array.from({ length: 5 }); // a length property is array-like → [undefined, undefined, undefined, undefined, undefined] Array.from({ length: 5 }, x => '💩'); // Array.from also can also take a map






















