0

I tried the following in my JavaScript console in Firebug (v.2.0.12):

function square(n) {
  return n*n;
}
monitor(square);

Although the console tells me that a monitor has been created successfully, I don't get any logging output once I invoke the function. It works as expected in Chrome's dev tools.

What am I missing? I already checked out the answer under How to use Firebug's monitor(fn)?, but it doesn't work for me either.

1 Answer 1

0

In Firebug monitor() only works on functions defined within the page's JavaScript code. It does not work on functions dynamically created via Firebug's command line!

So if your page looks like this:

<script>
function square(n) {
  return n*n;
}
</script>
<button onclick="square(Math.round(Math.random() * 100))">Create random square</button>

Enter this into the command line and hit Enter:

monitor(square)

When you then click the button, the output will look like this:

output of monitor()

Btw., you can keep track of the monitors you created through the Breakpoints side panel within the Script panel. In there they are listed as Logged Functions:

Logged functions being listed within the *Breakpoints* side panel

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.