• It really does execute the code. For example:

    var a = [];
    for (var i=0;i<100;i++)a[i]=i;
    

    will create a 100 element array called a after it is uploaded.

    However functions (and what is in them) won't be executed (unless you explicitly execute them). So:

    function foo() {
      var a = [];  
      for (var i=0;i<100;i++)a[i]=i;
      return a;
    }
    

    won't create an array. All that is stored is some data representing the function, and the source code inside it.

    It might be worth taking a look at this: http://www.espruino.com/Performance

  • Thanks. I have looked at Performance page, Compilation, Inline Assembler, and other related documentation, but it took a couple more examples to sink in. When you said execute, I was confused by the exact example you showed above where the function would not be executed until actually called. This has helped a bunch.

About

Avatar for CanyonCasa @CanyonCasa started