2
I have two JSON arrays in Javascript and both are like this.
First array:
[""Amarelo"", ""Amarelo"", ""Amarelo"", ""Preto"", ""Preto"", ""Preto""]
Second array:
[""Pequeno"", ""Médio"", ""Grande"", ""Pequeno"", ""Médio"", ""Grande""]
And I can have two variables that change by clicking that can be, for example "yellow" and "medium".
The question is: how do I know the index of when the values of the variables match those of the arrays?
Looking like this I know that the index that gives "match" is 1, but how do I make Javascript discover it by itself?
At this discovered index value I will be able to call the rest of the content dynamically.
Can anyone suggest a north for me?
you could do a "for" to go through the arrays.
– Vitória Moraes
Yes, I imagine that this is the way, but I had no idea what the logic would be for such or how to structure this action. Would you do a for each array? Or would you pick that up at a while? I haven’t had the balcony yet. :(
– Walacy Machado
The two arrays always have the same length?
– bfavaretto
Yes, they both have the same length.
– Walacy Machado