[removed] access to an object's member by name

前端 未结 2 1216
面向向阳花
面向向阳花 2020-12-11 18:21

I have an object called themesData:

var themesData = {}
themesData.a = { key: \"value\" }; 
themesData.b = { key: \"another value\"};

2条回答
  •  半阙折子戏
    2020-12-11 18:43

    themesData["a"].key does what you need and is equivalent to themesData.a.key, still the "array index style" notation allows you to dynamically generate index names.

提交回复
热议问题