Spread Operator

Added in ES 2015
The array spread operator is symbolized with three dots (. . . )
This operator converts an array to a list of items.

const newArray = [. . . oldArray]; 

Passing a list of arguments to a function

const myArguments = ['arg1', 'arg2', 100] 

myFunction(. . .myArguments);
function myFunction1(text1, text2, number1) {
}

this could also be done using array destructuring




© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext