Chrome's JavaScript console used to have a very helpful feature where if you entered the name of any function visible in the current scope it would print the complete definition of that function. Essentially as described in this answer here.
Some time ago (I think at least a couple of months, could be more) it stopped doing this, however, and entering a function name now gives a very unhelpful response, like:
I know I can click on that line (or right-click, and choose 'Show Function Definition') to be shown the function-definition in the 'Sources' tab, but that's very clunky compared to the previous inline function definitions (for a workflow that's typically along the lines of 'get the function definition, copy/paste into the console, change a few things, then overwrite the original function definition').
Another trick is to add a + ""
after the function name (as in jobClicked + ""
instead of jobClicked
), which shows the code in the console but loses all of the syntax highlighting.
Is there any way to get the JavaScript console to go back to its previous behavior of displaying the complete function definition inline inside of the JavaScript console, with the syntax-highlighting intact?
To find the JavaScript function definition in Google Chrome, open the web browser and press F12 to reach Developer Tools. Search for function and that's it.
Open Chrome, press Ctrl+Shift+j and it opens the JavaScript console where you can write and test your code.
When inspecting an object that contains in the Console, right click on a function and you will see a handy "Show function definition". It will take you to the place in the source code where the function is defined! Alternatively, you can just hover over the function () { word to preview function body in a tooltip.
Right-click in a webpage and then select Inspect. DevTools opens. Or, press Ctrl + Shift + J (Windows, Linux) or Command + Option + J (macOS), to directly open the DevTools console. If necessary, click in DevTools to give it focus, and then press Esc to open the Console.
It's working in version 54. You can update your Chrome browser.
Example function table:
Chrome version:
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