js 动态声明变量

var  object = {};

for(var i=0; i<5; i++){

  object['attr'+i] = i;

}

原文地址:https://www.cnblogs.com/zhucj/p/9644599.html