8

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:

enter image description here

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?

Community
  • 1
  • 1
aroth
  • 54,026
  • 20
  • 135
  • 176
  • It seems to be working again in Chrome v52 on Mac OS X. Is this still an issue? – flitig Oct 04 '16 at 20:54
  • Are you typing "myGreatFunction" or "myGreatFunction()"? – Joshua Nov 09 '16 at 08:09
  • The former. Typing the latter into the console will attempt to actually execute the function. – aroth Nov 10 '16 at 01:54
  • 1
    @flitig - Definitely still an issue, at least under Windows and with Chrome v54. – aroth Nov 10 '16 at 01:58
  • It's working for me too, probably it's a Chrome update that broke it. Actually Dev Tools have been broken quite much with the latest releases – Luca De Nardi Nov 30 '16 at 12:46
  • There's always the .toString() and .toSource() functions, if all else fails. At least they can give you copyable text like you want. – DaveS Dec 02 '16 at 12:50

1 Answers1

1

It's working in version 54. You can update your Chrome browser.

Example function table:

Example function table

Chrome version:

Chrome version

Maximillian Laumeister
  • 19,884
  • 8
  • 59
  • 78