14

Since yesterday, for some reason each time I try to display the console log in Firefox I get an undefined instead:

Enter image description here

I use this tool quite often, and just recently I saw that this is not working anymore. I have seem similar questions on Stack Overflow, but none of them with an answer to fix it.

This is what I have done so far to try fix it. I have already

  • Reinstalled Firebug
  • Reinstalled Firefox

And nothing seems to work. However, when I type "console" and hit the run button I get:

Is it a set up that I have to change?

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Manza
  • 2,109
  • 1
  • 27
  • 34
  • Same problem here. Firefox 50.1.0 Windows 8.1 (64-bit) – terratunaz Feb 02 '17 at 04:58
  • same here version 51.0.1 Debian (64-bits). The native console works (`right-click` + `Inspect (Q)` ) but I need firebug specially because of firephp – Asenar Feb 10 '17 at 14:17
  • 1
    I was preparing an answer for you thinking that you are using Firefox DevTools only to find out that you're using firebug that is not maintained any longer. Please consider moving to Firefox DevTools that more mature software and more robust. – user10089632 Aug 18 '17 at 08:20
  • Possible duplicate: *[Why does this JavaScript code print "undefined" on the console?](https://stackoverflow.com/questions/10263190/why-does-this-javascript-code-print-undefined-on-the-console)* – Peter Mortensen Oct 20 '20 at 18:28

3 Answers3

8

Firebug is no longer being maintained. From getfirebug.com:

The Firebug extension isn't being developed or maintained any longer. We invite you to use the Firefox DevTools instead, which ship with Firebug.next

See also Migration from Firebug guide.

Domenic D.
  • 5,276
  • 4
  • 30
  • 41
  • If people are looking for the alternative to the console, the Scratchpad in developer tools is a good option. – Melissa Feb 15 '17 at 22:49
  • @Melissa is scratch pad the same as what (Ctrl + Shift + K or Ctrl + Shift + I) brings up? – HattrickNZ Mar 13 '17 at 20:44
  • @HattrickNZ I'm not sure as I am on a mac and those do nothing, but here is more info https://developer.mozilla.org/en-US/docs/Tools/Scratchpad – Melissa Mar 13 '17 at 21:44
4

Further to Domenic D.'s answer, I thought it might help others to give a fuller explanation.

It's showing 'undefined' because that's the return value of the function console.log().

It isn't outputting 'test' into the console because Firebug is no longer maintained and doesn't support the latest versions of Firefox. One of the problems I've noticed as a result of this, is that logging using console.log() doesn't show up in the Firebug console anymore.

Unfortunately (if you are used to Firebug), the solution is to use Firefox's built in developer tools instead.

To load the console using Firefox's built in tools, press ctrl+shift+k. Here, console.log() will work as expected. For example, running console.log('test') as you have above, will output 'test', then undefined (the return value of console.log()).

dean3148834
  • 151
  • 6
1

Keep Firefox and Firebug both tools opened. Do whatever you want in Firebug and the result will appear in the Firefox console.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sugat Mankar
  • 478
  • 4
  • 16