Spread Syntax

PHOTO EMBED

Wed Jun 28 2023 01:54:08 GMT+0000 (Coordinated Universal Time)

Saved by @gbritgs #javascript

//Combining arrays
const obj1 = 
{
  name: 'A',
  age: 25
},
{
  name: 'B',
  age: 25
};

const obj2 = 
{
  name: 'C',
  age: 25
};

const total = [...obj1, ...obj2];

// getting elements from array
const [a, b] = total;
//console.log: a = first element from total

content_copyCOPY