Reputation: 1257
In the past, if I had a function test
with the content
function test () {
return true;
}
and I typed test
into console, then I'd get back:
function () {
return true;
}
Now however, it just returns function test()
without the actual function code. How do I change it back to how it was (or at least get the function code)?
Upvotes: 2
Views: 304
Reputation: 10991
The new behavior has since been modified for this.
Now the first few lines of the function are shown. So short functions will just display like they used to. However, longer functions are truncated with the link back to the source for context.
Upvotes: 0
Reputation: 7246
This feature was replaced by links to the sections of code where the function was defined. If you follow the link, you can still get to the method definition, just with more context. If you'd like to see the full method definition, try calling toString on it, or just coercing it into a string with addition.
function test() { return true; }
test.toString(); //=> "function test() { return true; }"
test + ''; //=> "function test() { return true; }"
Chrome DevTools is open source and has an issues page where you can submit feature requests. If you'd like the option to turn on the old behavior, post an issue there.
Upvotes: 6