We use array literals and rest syntax (like `[a, b, ...arr]`) all the time to create and manipulate arrays. But we often don't know the exact details of how this syntaxes work in Javascript.
So, today we will answer these in details -
1. How does array literal create a array, step-by-step?
2. How rest syntax (...arr) consumes values from a existing array or iterable?
3. How does in-built Array iterator work? (with polyfill)
0:00 Start
0:40 Quiz about rest syntax
1:18 Quiz answer + explanation
2:17 Basic array literal - [10, 20]
4:20 Array with holes - [10, , 20]
5:49 Rest in array literal - [...arr]
6:38 Iterator protocol
7:53 How ... consumes iterators
9:53 Inbuilt array iterator - case 1
11:15 Inbuilt array iterator - case 2
13:25 How does inbuilt Array Iterator work? + code
20:10 Outro
#BitsOfEcmascript
On this page of the site you can watch the video online Rest syntax in Array literals | Javascript In depth, from spec with a duration of hours minute second in good quality, which was uploaded by the user bendtherules 26 July 2020, share the link with friends and acquaintances, this video has already been watched 787 times on youtube and it was liked by 30 viewers. Enjoy your viewing!