Created
June 4, 2024 06:23
-
-
Save sukeharu/622227d70b0e367ef4be4f993a3e655a to your computer and use it in GitHub Desktop.
スプレッド構文でオブジェクトを結合する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// スプレッド構文でオブジェクトを結合する | |
// オブジェクト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