-
-
Save ilearnjavascript/7a95fc91a76971af13d586a5ec4b1670 to your computer and use it in GitHub Desktop.
es6 - classes - 6.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class es6_Person { | |
constructor(firstname, lastname) { | |
this.firstname = firstname; | |
this.lastname = lastname; | |
} | |
greet() { | |
console.log('Hello I am ' + this.firstname + ' ' + this.lastname); | |
} | |
} | |
var john = new es6_Person('John', 'Doe'); | |
john.greet(); // outputs: Hello my name is John Doe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment