... operator javascript

JavaScript
let a = { a: 0, b: 1 };
let b = { b: 2, c: 3 };
let c = { ...a, ...b };

console.log(c);

output -> {a: 0, b: 2, c: 3}//The operator ... is part of the array destructuring.
//It's used to extract info from arrays to single variables.
//The operator ... means "the rest of the array".
var [head, ...tail] = ["Hello", "I" , "am", "Sarah"];
console.log(head);//"Hello"
console.log(tail);//["I", "am", "Sarah"]

//It can be used to pass an array as a list of function arguments
let a = [2,3,4];
Math.max(a) //--> NaN
Math.max(...a) //--> 4let obj1 = { foo: 'bar', x: 42 };
let obj2 = { foo: 'baz', y: 13 };

let clonedObj = { ...obj1 };
// Object { foo: "bar", x: 42 }

let mergedObj = { ...obj1, ...obj2 };
// Object { foo: "baz", x: 42, y: 13 }Operatorvar x = 5;         // assign the value 5 to x
var y = 2;         // assign the value 2 to y
var z = x + y;     // assign the value 7 to z (5 + 2)/* JavaScript shorthand -=
-= is shorthand to subtract something from a
variable and store the result as that same variable.
*/

// The standard syntax:
var myVar = 5; 
console.log(myVar) // 5
var myVar = myVar - 3;
console.log(myVar) // 2

// The shorthand:
var myVar = 5;
console.log(myVar) // 5
var myVar -= 3;
console.log(myVar) // 2

Source

Also in JavaScript: