3 ms·
Pretty sure browsers no longer permit overriding ctors for literals.
by the_mitsuhiko 10y ago
Pretty sure browsers no longer permit overriding ctors for literals.
- gavinpc 10y agoThe John Resig post linked by TFA indicates that this was originally dealt with by locking the constructor altogether: function Array(){ alert("hello, I found something of yours!"); } // ERROR: redeclaration of const Array But it appears that the restriction now applies only to literals, as I can do this in at least Chrome and Firefox: function Array() {console.log("hope")} undefined var x = new Array(3); hope undefined https://johnresig.com/blog/re-securing-json/ https://johnresig.com/blog/re-securing-json/