javascript: how to call variable instance inside variable? -


i trying make this:

var test =  {     a:function()     {      array = new array();      array[0] = new array("1","2","3");      array[1] = new array("name","age","blabla");     },      b: function()     {       var c = new this.a();       alert(c);   //output:: object object       alert(c.array[1]); // output:: undefined       alert(c.array[1][0]); // output undefined     }     } 

how can alerted example alert(c.array[1][0]) output "name". in other languages possible use methodes inherited classes in javascript. think(hope) it's possible, how?

painkiller

you'd have change a:

a:function() {  this.array = new array();  this.array[0] = new array("1","2","3");  this.array[1] = new array("name","age","blabla"); }, 

if change it, you'd better this:

a:function() {   this.array = [ [ "1", "2", "3" ], [ "name", "age", "blabla" ] ]; }, 

the "array" constructor pretty bad api design , should avoided.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -