// CLASSES
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
greet() {
return `Hello, my name is ${this.name} and I am ${this.age}`;
}
}
const person1 = new Person('John', 33);
const person2 = new Person('Sara', 28);
// TEMPLATE LITERALS
//PREVIOUS////////////////////////////////////////
//EX1
var name = 'Your name is ' + first + ' ' + last + '.'
var url = 'http://localhost:3000/api/messages/' + id
//EX2
var roadPoem = 'Then took the other, as just as fair,\n\t'
+ 'And having perhaps the better claim\n\t'
+ 'Because it was grassy and wanted wear,\n\t'
+ 'Though as for that the passing there\n\t'
+ 'Had worn them really about the same,\n\t'
var fourAgreements = 'You have the right to be you.\n\
You can only be you when you do your best.'
//ES6////////////////////////////////////////
//EX1
var name = `Your name is ${first} ${last}.`
var url = `http://localhost:3000/api/messages/${id}`
//EX2
var roadPoem = `Then took the other, as just as fair,
And having perhaps the better claim
Because it was grassy and wanted wear,
Though as for that the passing there
Had worn them really about the same,`
var fourAgreements = `You have the right to be you.
You can only be you when you do your best.`