Search code examples
numeric

Access Javascript Array with numeric key


I tried to access the following value in an multidimensional array:

var temp = allSliderData[i]['slider_full'][j].path;

and it works fine, but the following not

var temp2 = allSliderData[i]['slider_thumbs'][j].285x255;

with the answer "SyntaxError: identifier starts immediately after numeric literal"

I now tried escapings, array functions .. this message is good known in stackoverflow .. but still no luck.

Could anybody help out?

THANKS!!


Solution

  • Something like that won't work. You can't have a property named "2" there. What exactly do you want to do?