K
K
kilisniki2021-11-22 17:04:27
JavaScript
kilisniki, 2021-11-22 17:04:27

How to change JS code in browser at runtime?

The site has downloadable scripts.
One of these scripts has a bug (presumably).
I want to debug him and tweak him for personal needs. At least I want to play.
The problem is that the code I need to change is preformed: in this example, it's an anonymous function. That is, something like this happens:

// some code
.onClick(() => { console.log("abc"); })


The code displays "abc" on click. I want to change a piece of code from "abc" to "def". (without redefining onCLick)
Once, for such a focus, I had to stop in the browser the moment the js code execution started, modify it and save it. But I have a hunch that it can be done in a more civilized way.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question