File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
questions/what-are-the-benefits-of-using-spread-syntax-and-how-is-it-different-from-rest-syntax Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ const newArray = [...array];
41
41
console .log (newArray); // Output: [1, 2, 3]
42
42
43
43
// Copying objects
44
- const obj = { name: ' John' , age: 30 };
44
+ const person = { name: ' John' , age: 30 };
45
45
const newObj = { ... person, city: ' New York' };
46
46
console .log (newObj); // Output: { name: 'John', age: 30, city: 'New York' }
47
47
```
@@ -66,8 +66,8 @@ const obj2 = {
66
66
qux: ' baz' ,
67
67
};
68
68
69
- const merged = { ... obj1, ... obj2 };
70
- console .log (copyOfTodd ); // Output: { foo: "bar", qux: "baz" }
69
+ const mergedObj = { ... obj1, ... obj2 };
70
+ console .log (mergedObj ); // Output: { foo: "bar", qux: "baz" }
71
71
```
72
72
73
73
### Passing arguments to functions
You can’t perform that action at this time.
0 commit comments