Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 350 Bytes

spreadSyntax.md

File metadata and controls

19 lines (13 loc) · 350 Bytes

Spread syntax

In ES6, spread syntax is useful to be able to copy objects without having to use Object.create, etc...

const person = {
  name: "Charlie"
};

const copiedPerson = { ...person };

//

function list(items){
  return [...items, "boop"];
}

const fullList = list(["beep", "bap"]); // return ["beep", "bap", "boop"];