My first Javascript object...


i attempting create javascript object.  far looks this:

 

function urlobject()

{

   this.firstname = false;

   this.troubled = false;

   this.syllables = new array();

   this.folders = new array();

   ...

 

   this.addtourl = addtourl;

   function addtourl(theword)

   {

       var sylcount = this.syllables.length;  //at point sylcount reported being undefined.

       this.syllables[sylcount] = theword;   //  of course, not work either.

       

   }

}

 

...

var urladdress = new urlobject();

 

 

i expected building objects advanced, straightforward.  have researched pubs , there noting in them suggests cannot create arrays within objects. why can't length syllables array in urladdress object?

works fine me... added line @ end of code:

urladdress.syllables.length

 

and returned 0.



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account