Thank you for your extremely informative response. This will sound dumb, but I hadn't even realized that console.log and
console.info were JavaScript functions -- I thought they were something "special" to Firebug only (whatever that means). Had I realized they were just functions, I would never have attempted to use any kind of conditional statements within the parentheses in the first place. All I've ever used as function parameters were variables, primitive values, or other functions.
I've been reading about named function expressions since reading your post. It seems they're useful for both recursion and debugging. I've gone back and added names to all my methods, and the debugging is going much better now.
I know I can use breakpoints with Firebug's stack trace panel, but that slows me down a lot for my current task; I'm constantly reloading and resizing the browser window, and I like seeing all the information flowing down in one stream in the Console.
I found your statement that you can use the ternary operator as a function parameter to be very interesting (and surprising). That turned out to be true; however, the syntax you showed was slightly wrong -- at least it is for the named versions I'm now using. Specifically... I'm testing my "resize illustration" code, and the resizeIllus function can be triggered either by various other code or by the user clicking directly on the illustration. So if I begin the ternary operator this way, analogous (I assume) to the code you suggested:
console.info(
resizeIllus.caller.name ? ...etc.
...it throws a JS error if the user has clicked. Turns out I have to test for the caller itself, not for
caller.name, even though it's the name (of the calling function) that I'm after. This works fine in Firebug:
By the way, the click code itself was set up simply like this:
illustration.onclick = resizeIllus;
...and I don't know how to make Firebug identify an event like that as the specific trigger (or caller) of a function, which would be an interesting thing if it were possible. Actually, I guess I could wrap the whole thing in another named function which would then be the caller... but in this case it doesn't matter since if the resize wasn't triggered by a function it must have been triggered by a click.
All very educational. Thanks again for your help!
P.S. I read this discussion group in my gmail account, and it displays parts of the code I insert as underlined blue links, even though they're not links at all. I have no idea why. It's a little annoying. Do other people see parts of my code that way? Any idea how I can stop it from doing that? Thanks.