How do I access an object property dynamically using a variable in JavaScript?

后端 未结 1 1228
野的像风
野的像风 2020-12-12 01:27

I’m trying to filter data from JSON in JavaScript.

I define a variable a. I want the property of whatever value a is equal to (not it

相关标签:
1条回答
  • 2020-12-12 01:59

    Try item[a], javascript objects can also be accessed this way.

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