1

I keep getting errors when I try to do simple things. It works perfectly but it just says Method definition shorthands are not supported by current JavaScript version. I just don't get it, I never had this problem before.

enter image description here

Thanks in advance

1 Answer 1

1

The syntax,

methods: {
   addMessage(message){
     this.messages.push(message)
   }
}

Is the newer Ecmascript method shorthand syntax. It sounds like your editor doesn't like it for some reason. You can use the old school syntax.

methods: {
   addMessage: function (message){
     this.messages.push(message)
   }
}

It looks like you can set the javascript version as a setting.

Sign up to request clarification or add additional context in comments.

2 Comments

I guess you beat me to it (by 55 secs!).
@d00dle Thats how it goes sometimes :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.