Calling javascript method from from inside object

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-12T01:56:50Z Indexed on 2010/05/12 2:04 UTC
Read the original article Hit count: 236

Filed under:
|
|
|

I am struggling with methods in JavaScript.

  obj = function(){
    this.getMail = function getMail (){
    }
//Here I would like to run the get mail once but this.getMail() or getMail() wont work
    }


var mail = new obj();
mail.getMail();

How do I make the method in a way that I can run it both inside the object and from the outside

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about method