0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

javascriptの分割代入

Posted at

分割代入を使用すると

const MyProfile = {
  name: "ゆう",
  age: 18,
}

const test1 = `名前は${MyProfile.name}です。年齢は${MyProfile.age}です`
console.log(test1); //名前はゆうです。年齢は18歳です。

これを

const MyProfile = {
  name: "ゆう",
  age: 18,
}

const {name, age} = MyProfile

const test2 = `名前は${name}です。年齢は${age}です`
console.log(test2); //名前はゆうです。年齢は18歳です。

のように書くことができる。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?