• Assume this simple Person 'class' definition with just value properties:

    var Person = function(name) {
      this.name = name;
    };
    

    Compare now both of these syntactically correct Person 'method' definitions:

    Definition 1:

    Person.prototype.spelled = 
        function() { return this.name.split("").join(" - "); };
    

    Definition 2:

    Person.prototype.spelled 
        = function() { return this.name.split("").join(" - "); };
    

    Why is 1 working and 2 throws the following runtime error:

    Uncaught SyntaxError: Got '=' expected EOF
     at line 1 col 5
        = function() { return this.name.split('').join(' = '); }...
    

    Has Espruino's rigid statement completion by semi-colon policy changed?

About

Avatar for allObjects @allObjects started