Nowadays, when you call a function's .toString()
, browsers return the function's original declaration.
But I remember that Firefox used to return an optimized version, eg.
function fn() {
return 2+3;
}
fn.toString() // Used to give: function fn() {return 5;}
On which browsers is it safe to use this feature?
From MDN:
Since Gecko 17.0 (Firefox 17 / Thunderbird 17 / SeaMonkey 2.14), Function.prototype.toString() has been implemented by saving the function's source. The decompiler was removed, so that the indentation parameter is not needed any more. See bug 761723 for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With