1 Reply Latest reply on May 7, 2013 12:56 PM by try67

    My first Javascript object...

    JADarnell Level 1

      I am attempting to create a Javascript object.  So far it looks like 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 this point SylCount is reported as being undefined.

             this.syllables[SylCount] = TheWord;   //  So of course, this does not work either.






      var URLAddress = new URLObject();



      I expected building objects to be advanced, but straightforward.  I have researched the pubs and there is noting in them that suggests I cannot create arrays within objects. So why can't I get a length from my syllables array in my URLAddress object?