1

enter image description hereenter image description hereI have a array called tableData, which has two elements inside it tableData[0] and tableData[1]. So I am accessing one of the column of tableData[1] like so

tableData[1][0].id , tableData[1][1].foo , tableData[1][2].bar and the list goes on.

But I don't want to hardcode it. The names id,foo,bar is in the tableData[0] that is actually all the heading of the columns and The tableData[1] has it's corresponding values. so I want to so something like this

tableData[1][0].tableData[0][1] But doing this for some weird reason say error Cannot read property '0' of undefined and I also tried this

var a = tableData[0][1].COLUMN_NAME
tableData[1][0].+a

But this is not possible? It says syntax error! How can I access the varible without hard-coding it.

Rehan
  • 3,813
  • 7
  • 37
  • 58

0 Answers0