I am new to javascript, and I have defined class like the following way-
function ClassName()
{
//Some code here
}
ClassName.prototype.memberFun = function(){
alert("I'm in memberFun()");
}
ClassName.prototype.memberFun1 = function(){
alert("I'm in memberFun1()");
//Trying to call above function like
this.memberFun();
}
Now, I am creating the object and calling the function here-
var ob = new ClassName();
ob.memberFun1();
But it is not working. I am getting an error saying-
Uncaught TypeError: Object #<Object> has no method 'memberFun'
Any help will be appreciated.