-2

I have been defining methods this way in my Vue app:

methods: {
  myMethod(arg) {
    // do stuff
  }
}

This is the way you typically see it:

methods: {
  myMethod: function (arg) {
    // do stuff
  }
}

My way looks a little cleaner, and both ways to work fine, but am I committing a great JS sin here? Will this come back to bite me somehow?

Glenn
  • 4,195
  • 9
  • 33
  • 41

1 Answers1

1

Yes, it's just a short way to define a method in ECMAScript 2015

Method definitions

Jonathan Dion
  • 1,651
  • 11
  • 16