0

How can I make a common function in my global.js to for calling debugger; in JS. I'll basically set a value whether to debug or not. I tried the following but it's not working. Any lead will be appreciated.

<script type="text/javascript">
var debugModeVal = 1;
debugMode = function() 
{
  if(debugModeVal)
  {
    debugger;
  }
  return;
}
</script>

I am calling from my html file like this

<script type="text/javascript">
function callAnotherFunction()
{
   debugMode;
}
</script>
Chopra
  • 571
  • 4
  • 8
  • 23

1 Answers1

0

use debugMode() instead of debugMode; in callAnotherFunction().

For debugging, use step out of the debugMode function to find yourself in the caller. Thanks to Jan Dvorak.

Chopra
  • 571
  • 4
  • 8
  • 23