Hello

By the way Javascript works Im not sure if this is possible but I would like to debug Javascript much like debugging C# or/and Java; I put a breakpoint in a line and press (for example) F5 so it goes to the next line/function and pauses and keeps going each time I press a key.

Is there any way how to do this?

Recommended Answers

All 5 Replies

If you use Firefox with firebug, here is the explanation. If you are using Chrome, someone has posted the picture of where you can push the step-in button. If you are using IE, good luck.

You can use debugger for setting breakpoints. it works like this:

var num1 = 0, num2 = 0, sum =0;
//set num1 to 4
num1 = 4;
//set num2 to 10
num2 = 10;
//here goes the debugger
debugger; //<--- code will stop right here
sum = num1 + num2;

Open your console then run the code: here's also a JSFIDDLE example i made: JSFiddle Example

OK, debugger is working pretty good for now. Ill keep playing with that.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.