Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sukeharu/622227d70b0e367ef4be4f993a3e655a to your computer and use it in GitHub Desktop.
Save sukeharu/622227d70b0e367ef4be4f993a3e655a to your computer and use it in GitHub Desktop.
スプレッド構文でオブジェクトを結合する
// スプレッド構文でオブジェクトを結合する
// オブジェクトfirst、オブジェクトsecondを結合してオブジェクトthirdを作る
const first = {
a: 1,
b: 2,
c: 3,
};
const second = {
d: 4,
e: 5,
};
const third = {...first, ...second};
console.log(third); // {a: 1, b: 2, c: 3, d: 4, e: 5}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment