-1

How to rewrite or change the js default function. For example. Substr is a predefined function in javascript. I want to change it to return some other result.

1 Answers1

0

Sounds like you are talking about prototypes:

String.prototype.show = function() {
  alert(this);
};

"Hello!".show(); // Hello!

Reece Casey
  • 154
  • 5