Skip to content

Instantly share code, notes, and snippets.

@lebowvsky
Created March 23, 2020 10:02
Show Gist options
  • Save lebowvsky/2eab16897e750320982d6771aaa25c3d to your computer and use it in GitHub Desktop.
Save lebowvsky/2eab16897e750320982d6771aaa25c3d to your computer and use it in GitHub Desktop.
<!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>
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