Wednesday, 24 October 2018

JavaScript console.log Tips & Tricks for Faster Development


Developers often underestimate the time it takes to debug something (this, unfortunately, includes me). Consequently, we are too lazy (and proud) to get a proper debugging environment going because, well, it’s a simple problem and will only take “a few minutes” to fix. This is where console.log() in JavaScript or var_dump(); die; in PHP come into play (I have a few tricks for that too). It might be dirty debugging, but it’s something everyone does. Years of experience in the deepest coding trenches have thought me a few tricks with console that save serious amounts of time & nerves. You should always set up a proper debugging environment so you can trace through code like a civilized person. Get off your high horse! Yes, in a perfect world that would be true, but we don’t live in a perfect world. I’m 100% sure that everyone who codes for a living uses console.log so why not use it more efficiently?
I never use console.log
Wait, what!? console.log() doesn’t tell you the whole story. You only get the line number where log() is placed but not the whole trace of how it was called, via what function(s). So if you have more than a few calls to
Source: https://managewp.org/articles/18012/javascript-console-log-tips-tricks-for-faster-development



source https://williechiu40.wordpress.com/2018/10/24/javascript-console-log-tips-tricks-for-faster-development/

No comments:

Post a Comment