Assume I do this in javascript
delete window.alert; // returns true
then the output of console.log(window.alert); will be \"
console.log(window.alert);
\"
The window object is a normal JavaScript object. You can simply "save" the alert function by keeping a reference to it.
window
alert
const alert = window.alert; delete window.alert; // window.alert is now undefined window.alert = alert;