0

I am trying to create

window1 = Ext.create('Ext.window.Window', {

then

window2 = Ext.create('Ext.window.Window', {

and so on

I want them to be created in the for loop that I already have but the standart dynamic variable names for JavaScript didn't work, probably because it wants me to write new or may be something to do with global scope, I don't know.

ilhan
  • 8,700
  • 35
  • 117
  • 201

1 Answers1

1

It's not really clear what you are asking, what's wrong with:

var myWindows = {};
for(var i=0; i<10; i++)
    myWindows['win'+i] = Ext.create('Ext.Window', { /* ... */ });
console.log( myWindows.win1 === myWindows['win'+1] ) // true

see: Object Access Notation

Community
  • 1
  • 1
Emissary
  • 9,954
  • 8
  • 54
  • 65