JSFiddle - React, Tailwind, and code Playground
by Scrappy Coco
JavaScript
//alert('test0');
window.alert = function(){Object.freeze(this)} ;
/*
/// from Andennour TOUMI
/// modified by scraaappy
*/
//alert('test1');//<-- if you call this it doesn't work anymore even in a try/catch statement
Object.unfreeze=function(o,fname){
var oo=undefined;
if( o instanceof Array){
oo=[];var clone=function(v){oo.push(v)};
o.forEach(clone);
}else if(o instanceof String){
oo=new String(o).toString();
}else if(typeof o === 'object'){
oo={};
for (var property in o){oo[property] = o[property];}
}else if (typeof o === 'function'){
oo=Window.prototype[fname];
}
return oo;
}
window.alert = Object.unfreeze(window.alert,'alert');
//window.alert = Object.unfreeze(window.alert,'prompt');
alert ('test4');