Calling one prototype method inside another in javascript

It’s easy:

Ob.prototype.add = function(){
    this.inc()
}

Ob.prototype.inc = function(){
    alert(' Inc called ');
}

When you create the instance of Ob properties from prototype are copied to the object. If you want to access the methods of instance from within its another method you could use this.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)