Created
March 23, 2020 10:02
-
-
Save lebowvsky/2eab16897e750320982d6771aaa25c3d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script src="person.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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 Person { | |
constructor(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
tellMyName(){ | |
console.log("I am " + this.name); | |
} | |
tellMyAge(){ | |
console.log("I am " + this.age + " years old"); | |
} | |
} | |
const john = new Person('John', 40); | |
const mary = new Person('Mary', 35); | |
john.tellMyName(); | |
john.tellMyAge(); | |
mary.tellMyName(); | |
mary.tellMyAge(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment