Mech
Mech

Reputation: 4015

Executing existing JS functions from Chrome DevTools

I have been copying existing functions from JS files on the server or from within the script tags into Chrome DevTools and then using the functions. I'm wondering if it's possible to skip the copying and use the existing functions directly from the preloaded code. If so, a helpful nudge in how to get started is all I need.

Upvotes: 1

Views: 73

Answers (1)

Shivam Gupta
Shivam Gupta

Reputation: 159

Within script tags

1)We will need to put a breakpoint in the script, somewhere after the function definition of the function you want to use it in console

By this point , the js knows about the function and we can use it in the console without copying it.

2)From js file on the server, which server is it,if its node js can load the node js file in the chrome browser..and repeat the step 1 process for this code too.

This might be help https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27

Upvotes: 1

Related Questions