Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法像这样命名一系列对象:
for (i=0; i<numberOfObjectsDesired; i++;) { Object ("thisone"+i); thisone+i = new Object(); }
这样 thisone0, thisone1, thisone2, thisone3, ... 等都是 Objects 的唯一实例
当然,它被称为数组:
var thisone = new object[numberOfObjectsDesired]; for (i=0; i<numberOfObjectsDesired; i++;) { Object ("thisone"+i); thisone[i] = new Object(); }
请注意,您必须将您的实例称为thisone[0],thisone[1]等,而不是thisone0, thisone1, ...
thisone[0]
thisone[1]
thisone0
thisone1