Start Browser Console with debugger command - Javascript Language Basics

Javascript examples for Language Basics:debug

Description

Start Browser Console with debugger command

Demo Code

ResultView the demo in separate window

<!doctype html>
<html>
   <head> 
      <title>Debugger Test Page</title> 
      <script>
function debugPrompt()/* www .ja v a2  s.c o m*/
{
        debugger; // breakpoint
        console.log("after debugger");
}
document.onkeydown = function()
{
    if (event.altKey && event.ctrlKey && event.keyCode === 'D'.charCodeAt(0))
    {
        event.cancelBubble = true;
        debugPrompt();
        return;
    }
}

      </script> 
   </head> 
   <body> 
      <button onclick="debugPrompt()">Debug</button>  
   </body>
</html>

Related Tutorials