jeudi 31 décembre 2015

Use of backtick in ember computed properties

The guides show a computed property written with backticks. I am not sure if they are necessary.

Could this:

fullName: Ember.computed('firstName', 'lastName', function() {
    return `${this.get('firstName')} ${this.get('lastName')}`;
})

Be rewritten as this:

fullName: Ember.computed('firstName', 'lastName', function() {
    return this.get('firstName') + ' ' + this.get('lastName');
})

?

For me, that's less obscure. What are the plus / cons of each method?




Aucun commentaire:

Enregistrer un commentaire