// I am trying to make a clone of String's replace function
// and then re-define the replace function (with a mind to
// call the original from the new one with some mods)
String.prototype.replaceOriginal = String.prototype.replace
String.prototype.replace = {}
この次の行は現在修正されていますか?javascriptのプロトタイプをカスタム関数に置き換える方法
"lorem ipsum".replaceOriginal(/(orem |um)/g,'')
それは私のために(Firefoxで)正常に動作します。 「壊れた」という意味を説明すると役に立つかもしれません。 – Pointy
合意、それはクロムでもうまく動作します:http://jsfiddle.net/4hPhG/ –
あなたのコードで間違っていることがわかるのは、最初のステートメントに ';'がないことです。 –