Interview GURU

What is the use of debugger keyword in JavaScript?

JavaScript debugger keyword sets the breakpoint through the code itself. The debugger stops the execution of the program at the position it is applied. Now, we can start the flow of execution manually. If an exception occurs, the execution will stop again on that particular line.. For example:

function display()  
{  
x = 10;    
y = 15;    
z = x + y;    
debugger;    
document.write(z);    
document.write(a);     
}     
display();