• Yes, you're totally right.

    I think it's the bit of JavaScript that takes the most effort getting your head around. While you can use JS like any other language, where delays are involved you're much better off using callback functions as above - which is pretty alien if you're used to just writing procedural code that executes linearly.

    The real bonus is that Espruino can keep doing other things inbetween running the code above. If you implemented it all as delays in something like C, the device wouldn't be able to handle much else while the LEDs were flashing.

About

Avatar for Gordon @Gordon started