restore default (built-in) function after overriding

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sultanwadood
    New Member
    • Mar 2007
    • 7

    restore default (built-in) function after overriding

    Hi all.
    I need to know how to restore or roll back to built-in function after overriding like following example.
    String.prototyp e.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
  • sultanwadood
    New Member
    • Mar 2007
    • 7

    #2
    call built-in from overridden function of Object in javascript

    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.prototyp e.substr= function(str)
    {

    return str.substr(0,5) ;
    }

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

    Comment

    • mrhoo
      Contributor
      • Jun 2006
      • 428

      #3
      You didn't override the function, you overwrote it- now you need to write a new function that does what the original one did, or use other methods that you have not improved to return a substring..

      Comment

      • sultanwadood
        New Member
        • Mar 2007
        • 7

        #4
        yes
        your are right it has actually been overwritten not overridden. but I want to switch back to the one which I have overwritten and to get rid of writting the function again.
        thanks for reply.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Threads on same topic so I've merged them.

          Comment

          Working...