[Javascript] window. alert = function () {}; // overwrite the alert method // write some code here to restore alert (1); // The alert dialog box window appears. alert = function () {}; // overwrite the alert method // write some code here to restore alert (1 ); // It is required that the alert dialog box be displayed to record this topic because someone has discussed it on Weibo and I wrote the answer directly. Method 1: Delete alert directly. [Javascript] window. alert = function () {}; delete alert; alert (1); window. alert = function () {}; delete alert; alert (1); this code is the simplest and best performing, and is recommended. Method 2: retrieve the original alert method from the prototype chain. Alert is the window method. Therefore, find window. constructor. prototype. alert and call or apply. [Javascript] window. alert = function () {}; window. alert = function (s) {window. constructor. prototype. alert. call (window, s) ;}; alert (1); window. alert = function () {}; window. alert = function (s) {window. constructor. prototype. alert. call (window, s) ;}; alert (1); Re-defines a function and overwrites it. The following alert function is not the original alert. window. constructor is compatible. IE does not support Window objects. Method 3: iframe method. Create a blank iframe, And the DOM in the iframe is clean. reference the alert in the iframe, and the warning dialog box is also displayed. I can only say that people who come up with this method really don't understand JS. The complexity of writing more code does not mean that the level is high. Real code experts always write less and simpler code.