0

I have an object like this:
var object = {"American":[{"question":"What is the capital?", "answer":"..."}, ... ]};
I have also a variable:
var language = "American";
So, my question is: How can i use the variable called language as a key for the array with all the questions? I have already tried this:
object.language[0].question and object.[language][0].question.

Sondre Sørbye
  • 529
  • 1
  • 7
  • 15

0 Answers0