1

i have this code below, but doesn't work. how i can set a variable as a multiple array index?

var tamanho = $(this).html();
var tamanhoNormal = { 
                    'P' : {'A' : 67,'L' : 50},
                    'M' : {'A' : 70,'L' : 52},
                    'G' : {'A' : 72,'L' : 54},
                    'GG' : {'A' : 75,'L' : 58}
                };
alert(tamanhoNormal.tamanho.A);

I really don't know how to do it. Thanks for any help

0

1 Answer 1

2

Supposing tamanho is "P", "M", "G" or "GG", then use

alert(tamanhoNormal[tamanho].A);
1
  • Thank You so much! You really helped me a lot :D I'm so newbie ! Commented Aug 13, 2013 at 19:49

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.