Javascript Debugging

I recently started messing with Project Euler problems, and I'm trying to solve them in Javascript. By doing this, I tend to create many endless loops, and now I wonder if there is a better way to break the script than to kill the tab in Firefox or Chrome?

In addition, firebug is still considered the “best” debugger (I myself do not see much difference between firebug and the dev web tool on safari / chrome).

How to have a good Sunday!

+3
source share
3 answers

, . Firebug script , , . , :

var intMaxIterations = 10000;
var go = function() {
    while(intMaxInterations > 0) {
        /*DO SOMETHING*/
        intMaxIterations--;
    }
};

... 10000 , - intMaxIterations < 9000. 1000 (, 1001 ). , , .

script ( , ), , , , . , - , , . . , , , . .

var intMaxIterations = 10000;
var go = function() {
    while(true) {
        /*DO SOMETHING*/
        intMaxIterations--;

        if (intMaxIterations < 0) {
            throw "Too many iterations. Halting";
        }
    }
};

: , , , script, - .

, , , JS , , , , . - , , . , ( , ) JS -, , . , , , .

, - , . , . . - MDC.

0

Firebug - .

. . , - ctrl + w, .

, :

:

Safari/Chrome: -

Opera , . (- > - > )

+1

Even though Firebug or webkit debuggers are good, the browser differently seems overhead for Project Euler. Why not use a runtime such as Rhino or V8 ?

0
source

Source: https://habr.com/ru/post/1765486/


All Articles