Hi all.
I need to know how to restore or roll back to built-in function after overriding like following example.
String.prototype.substr= function()
{ return "";}
Now I want to use the one already built-in.
I shall be very thankful if some one could help me.
Sultan Wadood

Recommended Answers

All 3 Replies

Hi All.
Do any body know how to call built in function of object like substr from overridden version. I am trying following example but the function called itself recursively not the function being overridden.
String.prototype.substr= function(str)
{

return str.substr(0,5);
}

I shall be very thankful if some one could give me some hints.
Sultan Wadood.

I don't think its possible to revert to the old function unless you save it somewhere.

eg:

String.prototype._substr = String.prototype.substr;

String.prototype.substr= function()
{

return this._substr(0,5);
}

my all poste problems have been solved.
thanks for helping and your valuable time.
Sultan Wadood.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.