javescript: JSONのプロパティを変数を使って定義する

Updated: 2019/12/2

 

1段階のnestであれば[]を使って簡単にできる。

f:id:monteecristoo:20190619174644p:plain

2段階ネストされた変数を使ったプロパティを新規に追加する場合

f:id:monteecristoo:20190619183312p:plain

下記ではエラー

f:id:monteecristoo:20190619183058p:plain

 

おまけ

f:id:monteecristoo:20190620050751p:plain

キーの取得

f:id:monteecristoo:20191202201408p:plain