JavaScript for Beginners #61 Spread Syntax

preview_player
Показать описание
Here, we will learn about the spread syntax or spread operator (...) in JavaScript. The spread operator will allow for an iterable like an array or a string to be unpacked in places where comma separated values are expected. This could be for building a new array or passing in values during a function call. Additionally, we will see that we can use the spread operator to make a shallow copy of an object or array.

0:00 Spread syntax definition from MDN
1:07 Rest syntax vs spread syntax
1:40 Using the spread syntax to copy the elements of an array
5:15 Using the spread syntax to combine two or more arrays
7:24 Using the spread syntax to make a shallow copy of an array
10:25 Using the spread syntax with strings
11:27 Using the spread syntax with arguments for function calls example #1
13:27 Using the spread syntax with arguments for function calls example #2
14:50 Using the spread syntax with objects

JavaScript Playlist:

MDN Spread Syntax:

NodeJS:

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

Thanks for distributing awesome tutorials...

Learning JavaScript — or any programming language — is so much fun; hard to imagine I once hated it!

Retrofire-
Автор

Thank you, it is a good tutorial! Hope you get more attention from yt algoritms

littlemaxy
Автор

I believe that a deep copy is being created for the 5th example. Spread operator will deep copy for any non nested literals

boxedog