Get property of object in JavaScript

前端 未结 3 1194
情歌与酒
情歌与酒 2020-11-28 14:29

Basically I have a form with a

提交评论

  • 2020-11-28 15:18

    Since you're referencing the property via a variable, you need the bracket notation.

    var gda_set = gdas[mode];
    

    ...which is the same notation you would use if you were passing a String.

    var gda_set = gdas["f"];
    
    0 讨论(0)
  • 2020-11-28 15:21

    You can use gdas[mode], it selects the element that is indexed by the value of mode.

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