The gather and spread operators are denoted by three dots (…). How they're used depends on the context. In an assignment context, it’s the gather operator. In a value list context, it’s the spread operator.
(Bamboo Flute)…- The next thing that we wanna talk about is this notion,…we might have had a function that looked like this before.…We wanted to get a list, an array,…of all the arguments that have been passed into foo…because we're gonna treat foo as a "variadic" function.…Simply means that we can pass zero, one, 500,…and maybe our function actually has different behavior…depending on how many arguments we passed, all right?…So, in the pass, the way that we wanted to get that…is we knew there was an arguments object,…but it was kind of annoying that that was an object…that was an array-like, but not a real array…because it didn't have stuff like slice and pop on it…and things like that.…
So let's say that there was a case where we wanted…to get the arguments array and add something…on to the beginning of it, we would have to turn it…into a real array.…So we would say something like var args is equal to…and then we did this crazy nightmare of stuff…where we borrowed the slice call from a real array,…or from the array prototype, but called it in the context…
This course was created by Frontend Masters. It was originally released on 01/10/2017. We're pleased to host this training in our library.
- The arrow function
- Arrow function variations
- Closures and explicit blocks
- Default values
- Using the gather and spread operators
- Dumping variables
- Concise properties and methods
- Symbols, iterators, and generators
- Optimizing codes for the reader
Skill Level Intermediate
1. Arrow Functions
2. Block Scope
3. Default Values and the Gather/Spread Operators
5. Template Strings
6. Symbols, Iterators, and Generators
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.