ES6 Tutorial - #9 Rest & Spread (Part 2)

preview_player
Показать описание
Spread Operator with Arrays

00:34 Passing array elements as args
03:40 Spread instead of apply()
04:08 Combining arrays with spread
05:35 (Shallow) Array Copying; spread replaces slice()
07:25 Array concatenation; spread instead of concat()
09:34 From an Arguments object to an Array
10:50 From an HTMLCollection to an Array

Spread Operator with Object literals

17:53 Merging object properties
19:30 Extending object properties
22:30 Spread with object destructuring

Rest Operator with function arguments

24:00 Extracting arguments into an array
25:08 Rest operator with arrow functions
25:39 Drawback of the Arguments object (recap)
26:40 Perks of using rest for function args (recap)

To pick up where we left off, let's continue exploring the rest and spread syntax with more examples. Just in under 30 min, we're going to cover everything from array concatenation and object to array conversion, to object cloning and destructuring, to function argument extraction into a single array. Tons of value packed in this one video, so without further ado, let's get into it!

(For reference)

Couldn't find anything better that the Mozilla docs... again.

Рекомендации по теме
Комментарии
Автор

Good god, FINALLY someone explains what let newObj={...oldObj, field:value} is actually doing. I am doing a freecodecamp react course, and the instructor is REALLY good, but all of a sudden he throws that abomination in there and doesn't even explain it. I SCOURED the internet looking for that. I read the ENTIRE MDN page on object destructuring. Nowhere did I find an explanation for this syntax. Except now.


I sincerely don't understand how you are so low on the youtube algorithm. I had never seen your videos before, and they are lightyears above and beyond most of the ones with hundreds of thousands of views. This whole series is being very helpful, and I'm sure the React one will be, too. Of course, with the changes over the years, I need to look around for different resources, but this one will definitely stay on my list. Well done.

TheTechnicalNirl
Автор

explained with so much Ease!

Thanks Alot for tutorial man!

karanmunjani
Автор

I'm one of the commenters below on a different account. Months later, just checking back in for a refresher on stuff that apparently the internet at large feels no need to explain anywhere else. This is for real funny at this point, *nowhere* else can I find this particular bit of information around 16:00... not even in the Mozilla docs, which I love with religious fervor.

franciscomagalhaes
Автор

Hi, Alex! Please correct me if I'm wrong, but I think at 23:15 you are talking about the rest operator and not the spread one.

bezedeadaniel
Автор

Lots of repetitions between 16:00-22:00. Mother of all skill ;)

JakubGodawa