spade operator typescript
function myFunction(x, y, z) {
console.log( x );
console.log( y );
console.log( z );
}
var parametersArray = [0, 1, 2];
myFunction(...parametersArray); //0, 1, 2
spade operator typescript
function myFunction(x, y, z) {
console.log( x );
console.log( y );
console.log( z );
}
var parametersArray = [0, 1, 2];
myFunction(...parametersArray); //0, 1, 2
spade operator typescript
let origArrayOne = [ 1, 2, 3]; //1,2,3
let origArrayTwo = [ 4, 5, 6]; //4,5,6
//Create new array from existing array
let copyArray = [...origArrayOne]; //1,2,3
//Create new array from existing array + more elements
let newArray = [...origArrayOne, 7, 8]; //1,2,3,7,8
//Create array by merging two arrays
let mergedArray = [...origArrayOne, ...origArrayTwo]; //1,2,3,4,5,6
spade operator typescript
let origObjectOne = {a: 1, b: 2, c: 3}; //{a: 1, b: 2, c: 3}
let origObjectTwo = {d: 4, e: 5, f: 6}; //{d: 4, e: 5, f: 6}
//Create new object from existing object
let copyObject = {...origObjectOne}; //{a: 1, b: 2, c: 3}
//Create new object from existing object + more elements
let newObject = {...origObjectOne, g: 7, h: 8}; //{a: 1, b: 2, c: 3, g: 7, h: 8}
//Create object by merging two objects
let mergedObject = {...origObjectOne, ...origObjectTwo}; //{a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us