Sunday, May 20, 2007

Replace javascript alert with Firebug's console.log

If you've been developing javascript for a while like me, you're probably the type that have alert messages everywhere in your code. Until firebug, came along that was the only way to determine the value of a variable.

With firebug installed on your Firefox browser, you can now replace the javascript alerts with console.log.


var myvar = "This is my variable"
console.log(myvar);


The above code will output the value of myvar in the firebug console when the page is loaded.

No comments:

Post a Comment