JavaScript Debugging Tips

Just thought I would share some very useful debugging tips that I have been using over the past two weeks to help with my portion of the CS401 project.
The most invaluable tool I use is Google Chromes developer tools: https://developers.google.com/chrome-developer-tools/docs/
The use of this is amazing for identifying issues not only with your JavaScript but also with CSS and HTML.
More specific to JavaScript are the following two tricks:

Console Logging

console.log("whatever you want to log"+ variables +"\n\t");

This is great for keeping track of variables and to notify when a function is called. This was a big help when I started implementing the swipe and jQuery Mobile styles.

Alerts

alert("whatever you want to log"+ variables +"\n\t");

This is an older technique that I still prefer when doing spot checks, the only problem I have run into with this is slowing down the reaction/smoothness of the functions being called. A benefit of this is that one does not need to view the JavaScript Console to see what is happening.

That’s all for now, I will definitely post more debugging tips if I come across any.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s