Javascript 如何在ionic中使用动态变量名

Javascript 如何在ionic中使用动态变量名,javascript,firebase,ionic-framework,Javascript,Firebase,Ionic Framework,在我的ionic应用程序中,我观看一个firebase路径“游戏”,它被复制到我的局部变量currentGame中。 示例路径: this.gameProvider.currentGame.round2.character4.somevalue 我最多有10发子弹。 我怎么能做这样的事情 for (i=1; i<10; i++) { console.log(this.gameProvider.currentGame.round + i + .character4.somevalue)

在我的ionic应用程序中,我观看一个firebase路径“游戏”,它被复制到我的局部变量currentGame中。 示例路径:

this.gameProvider.currentGame.round2.character4.somevalue
我最多有10发子弹。 我怎么能做这样的事情

for (i=1; i<10; i++) {
  console.log(this.gameProvider.currentGame.round + i + .character4.somevalue);
}
用于(i=1;i使用

gameProvider={currentGame:{}

对于(i=1;iperfekt回答!谢谢:-)