SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    calling a function from within a function in an object

    I am trying to call a function from within a function. like this but it doesnt work:
    Code:
    var a = {
    
        "functiona":function(){
        
                alert(this.functionb());
    
         },
        
         "functionb":function(){
    
                return 'hello';
     
          }
    
    }
    I am unable to use this, self or parent. Any help or advice appreciated.

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Property names don't need to be specified as strings.

    How are you calling the method?

    Code:
    a.functiona();
    Tab-indentation is a crime against humanity.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •