0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

オブジェクトの分割代入

0
Posted at

概要

JavaScriptではオブジェクトのプロパティを指定して値を抜き出して変数に代入できます。これをオブジェクトの分割代入といいます。

定義側

const {user:userName} = {id:1, userName:"Hoge"};
console.log(user);

表示内容

Hoge

説明

上の例では、オブジェクトの属性userNameを指定して、その値Hogeuserという名前の変数に代入しています。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?