function Lexer(exp){ this.exp = exp; this.lexe=function(){ console.log(this.exp+'lex') } } Lexer.prototype.lexe=function(){ console.log(this.exp); } lexer=new Lexer('a+b') lexer.lexe()