Hacker News new | past | comments | ask | show | jobs | submit login

Use console.log() instead of alert. In Firebug you can do this with any object and inspect it. But be aware that those objects are "live" - if they change at some poing later in your code, the console object will update. If I need to inspect an object in isolation, I throw an exception right after console.log()



I shortened console.log() with a function I use in development called c()

    function c(x){
        console.log(x || "!");
    }
It's pretty helpful, I can quickly throw the line c(); anywhere just to log if it happens when/if it should. And it stays out of your way, unlike alert() which is terrible and should be deprecated.


> But be aware that those objects are "live" - if they change at some poing later in your code, the console object will update.

Not in firebug (anymore), although the hyperlink will lead to the object itself, in its new version: http://jsfiddle.net/sgGEW/

The Webkit console does have that issue.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: