You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • The command-line still evaluates everything in order, as you type it... The if statement won't evaluate again unless you tell it to.

    You could do something like:

    setInterval(function() {
     if (a != b) {
        var b = a;
        var c = 1;
        var d = 1;
        var e = 1;
        var f = b+c+d+e;
     }
    },100);
    

    And now, that code will keep being called every 100ms so if you write a=20, everything will update as you expect.

About

Avatar for Gordon @Gordon started