Javascript - access object member when identifier string is stored in a var

后端 未结 1 1803
难免孤独
难免孤独 2020-12-18 04:40

I\'ve got a pretty simple question (and tentative answers), I just want to see if maybe there is a better answer out there.

How can you access an object member in ja

相关标签:
1条回答
  • 2020-12-18 04:43
    var message = messages[state];
    

    Every object in JavaScript is not only an object in the more usual sense, but it is also a dictionary populated by its members.

    0 讨论(0)
提交回复
热议问题