Skip to content

Commit

Permalink
update(JS): web/javascript/reference/operators/spread_syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
undead404 authored and AdriandeCita committed Aug 7, 2022
1 parent 186933a commit 299e5c5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ browser-compat: javascript.operators.spread
```js
myFunction(a, ...iterableObj, b)
[1, ...iterableObj, '4', "п'ять", 6]
({ ...obj, key: 'значення' })
{ ...obj, key: 'значення' }
```

## Опис
Expand Down Expand Up @@ -178,7 +178,7 @@ arr1 = [...arr2, ...arr1];
### Розгортання в об'єктних літералах

Поверхневе клонування (без врахування прототипа) чи злиття обєктів є можливим із застосуванням стислішого синтаксису, ніж {{jsxref("Object.assign()")}}.
Поверхневе клонування (без врахування прототипа) чи злиття об'єктів є можливим із застосуванням стислішого синтаксису, ніж {{jsxref("Object.assign()")}}.

```js
const obj1 = { foo: 'bar', x: 42 };
Expand All @@ -199,7 +199,7 @@ Object.assign(obj1, { x: 1337 });
console.log(obj1); // Object { foo: "bar", x: 1337 }
```

На додачу, {{jsxref("Object.assign()")}} провокує виклик сеттерів цільового обєкта, а синтаксис розгортання – ні.
На додачу, {{jsxref("Object.assign()")}} провокує виклик сеттерів цільового об'єкта, а синтаксис розгортання – ні.

```js
const objectAssign = Object.assign(
Expand Down

0 comments on commit 299e5c5

Please sign in to comment.