Nearby lessons
12 of 22JavaScript: Spread Operator
📌 What is Spread Operator?
The Spread Operator (...) allows you to expand iterable elements (like arrays or strings) into individual elements. It is also useful for cloning or merging arrays and objects.
1️⃣ Spread Operator with Function Arguments
You can use the spread operator to pass array elements as separate arguments to a function.
Example02
2️⃣ Spread Operator with Arrays
You can use ... to clone or merge arrays easily.
Example03
3️⃣ Spread Operator with Objects
Spread operator can also be used to merge or clone objects.
Example04
4️⃣ Shallow Copy Limitation
Spread operator creates a shallow copy of objects. Nested objects are still referenced.
Example05
🧠 Test Your Knowledge
3 QuestionsProgress: 0 / 3