• Good morning!

    I just tried to use JavaScript getters and setters, but got the response:

    >Uncaught SyntaxError: ID/number following ID/number isn't valid JS

    If getters and setters are unsupported, is there some documentation which defines the supported JavaScript features?

  • Which code produced that error?

  • After some (purely syntactical) experiments, I found that getters/setters within IIFEs seem to be the problem. When trying

    let Y = {
      get y () { return this._y }
    (function () {
      let X = {
        get x () { return this._x }

    (edited in the right section of the Espruino IDE, then uploaded to my Bangle.js) the Y-based constructs worked as foreseen (and even produced the intended output), but then the X-based stuff failed.

    So, IIFEs seem to have their own (inner) capabilities?

  • There's a features list at http://www.espruino.com/Features

    Looks like this is to do with the 'pretokenise' feature I turned on in Bangle.js to save a bit of RAM.

    If you add 'E.setFlags({pretokenise:0})' before uploading your code then it'll be fine

    edit: filed issue here: https://github.com/espruino/Espruino/iss­ues/1745

  • Thank you very much - that feature list is very helpful!

  • fixed now

  • Great! Thanks a lot for your effort!

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

doesn't Espruino/Bangle.js support getters and setters?

Posted by Avatar for Andreas_Rozek @Andreas_Rozek