Great article on using console.log()

Just got this in an email, a LOT of great substance in this. JS has a very robust console API, and it is a very powerful tool in the web developer’s toolbelt.

For those who aren’t using it yet, press <f12> on your keyboard, or (depending on the browser) ctrl(cmd)-shift-I to open the console. When your javascript is running, syntax errors will usually pop up here, and it’s a great way to catch errors in your code. You can see warnings from the system for deprecated usages, or syntax errors, or (the best bit) you can display your own stuff here.

Debug messages, benchmark timing results, output of variables, all sorts of things can be displayed right there in the console, simply by adding one of the console calls. You’ll often see it used on sample code in the forum, something like

console.log("The value of myVariable: "+myVariable );

But wait! There’s more! The console also includes a command line, where you can run (and test) javascript snippets directly in the console! You can use this to check the value of variables during operations, or to check data structures, or whatever!

Whether you’ve never used console, or it’s your go-to gadget, I strongly suggest reading more about it here:


thanks a lot for the helpful article

nice to know about this and thanks for sharing it with us

Thank you very much this is a great read, I apreciate you pointing me to this post, and ultimately the article. I knew of a few console functions but this opens more troubleshooting possibilities. Thank you.

1 Like