...see more

The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected.

Spread operator doing concat

let arrayOne = [1, 2, 3];
let arraryTwo = [4, 5];
arrayCombined = [...arrayOne,...arrayTwo];

Add item using spread operator

let arrayOne = [1, 2, 3];
arrayNew = [...arrayOne, 3];

Spread syntax (...) - JavaScript | MDN (mozilla.org)

Comments

Leave a Comment

All fields are required. Your email address will not be published.