LoginSignup
1
0

More than 3 years have passed since last update.

JavaScriptにおけるconst {a, b, c} = data; の手法名

Last updated at Posted at 2019-09-24

検索しようと思って毎回忘れるのでメモ。
とりあえず名前がわかればその後はググれる。

オブジェクトの分割代入という。

Arrayも可能。

const [a,b] = [1,2];

キー名の変更も可能。感覚とは逆に指定するので注意

var {aa: a , bb: b } = {aa: 3, bb: 5};

デフォルト値の設定もできる

var {a = 10, b = 5} = {a: 3};
1
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
1
0