javascript debugging tips and tricks

23
Debugging Tips and Tricks C# Corner - Delhi Chapter 5th Sep 2015

Upload: sunny-sharma

Post on 20-Jan-2017

206 views

Category:

Education


3 download

TRANSCRIPT

JavaScript Debugging

Tips and Tricks

C# Corner - Delhi Chapter 5th Sep 2015

< About me />Sunny Sharma• Trainer / Author / Speaker• [email protected]

om• Twitter: @sunny_delhi

Common Mistakes

Undefined Variable(s)

Misspelling

Case Sensitivity Issues

Missing / Mixed Quotes

Incorrect Number of Closing Braces

Incorrect Number of Closing Parenthesis

Using Method as a Property

Missing “+” during concatenation

NaN

Using Equals (=) Rather than Equality (==)

Debugging

alert();

console.log(“Hey!”);

try / catch / finally

Sequential Uncommenting

Steps:• Comment all your code• Uncomment first block of code (function)• Test if works fine• Uncomment next block of code• Test if still works fine• Carry on till you reach the end OR find the buggy line of code!

• Boring, right?

Developer Tools

Developer Tools - Common Terms

o Consoleo Breakpointo Step Ino Step Overo Step outo Call Stacko Watch

Play / Pause script execution

Step Over Step Out

Step In Disable Breakpoints

Pause on Exceptions

Developer Tools - Common Terms

Thank You!