Here's a specific problem:
I found a website like this:
index.html
<html>
<head>
<script src="script.js"> </script>
</head>
<body>
</body>
</html>
script.js
(function(){
var x = 2;
alert(x)
})();
I wish I could change x to 5 (so that it alerts 5), however I can't do it from the console because I can't access the anonymous function and because the alert would have already been executed before I could change anything.
Normal solution would be to change x to 5 in the script itself however the script is not on my server so I can't change it directly.
I can of course modify it locally so how can I make it so that every time I visit this website, the local script is executed instead original script? (I use Firefox by the way)
Thank you in advance!