Home » JavaScript » JavaScript While Loop » Question

JavaScript While Loop

  1. Consider the following code snippet
    function fun(f) 
    {
    if (f === undefined) debugger;
    }

    What could be the task of the statement debugger?
    1. It is used to find error in the statement
    2. It is used as a keyword that debugs the entire program at once
    3. It debugs the error in that statement and restarts the statement’s execution
    4. It does nothing but a simple breakpoint
    5. None of these
Correct Option: D

The debugger statement normally does nothing. If, however, a debugger program is available and is running, then an implementation may (but is not required to) perform some kind of debugging action. In practice, this statement acts like a breakpoint: execution of JavaScript code stops and you can use the debugger to print variable’s values.



Your comments will be displayed only after manual approval.