window equivalent

Posted on
  • In browser environment, every global variable in javascript is a member of the window variable.

    E.g. setTimeout is the same as window.setTimeout.

    I've noticed that there is no window variable available? Is there something similar?

    I'd like to be able to do something like

    var a = 1;
    digitalWrite(global['LED' +a], 1);
    

    Is this possible?

  • Check out this other post: http://forum.espruino.com/conversations/573/

    There isn't a way to do this properly right now, but you can always just use eval. Ideally you would just put the 3 LEDs in your own array though.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

window equivalent

Posted by Avatar for user6415 @user6415

Actions