JavaScript Debugging

As you know that an error in a program is called as a bug. Therefore, when it is required to debug your JavaScript program then you have to locate and correct the errors of that program.

Basically debugging is a process of finding and rectifying the bugs or defects of a computer program or a piece of electronic hardware.

Debug a JavaScript Program

When you debug a program then first you need to start with a problem, isolate the source of the problem, and finally fix it.

A debugged program means that all the bugs have been removed from the program or you can say that the program is free from errors.

Techniques of Debugging a JavaScript Program

Here are the two techniques you can use to debug your JavaScript program:

  • JSLint checker
  • Browser sniffing

Debugging JavaScript Program using JSLint Checker

JSLint is an online validator used to debug the JavaScript code. You will find it has two fields, one is text field to set the JavaScript code and second is JSLint button to press and check for errors in your JavaScript code. If your JavaScript code contains any error then JSLint generates the error message with the line number where the error has occurred.

Debugging JavaScript Program using Browser Sniffing

Browser sniffing is a process of detecting the information related to a browser such as name, version, operating system and type of the browser.

Browser sniffing also detects the runtime environment of the browser in which a web page is executed.

Browser sniffing restricts the code fragments of the language that might be JavaScript or any other language that are either having the bugs or not browser specific.

JavaScript Online Test

« Previous Tutorial Next Tutorial »

Follow/Like Us on Facebook

Subscribe Us on YouTube