Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //JS_Practice
- // function printMyName(name) {
- // console.log(name);
- // }
- // const multiply = (number) => {
- // return number*2;
- // }
- // console.log(multiply(2));
- class Human {
- constrctor() {
- this.gender= 'male';
- }
- printGender() {
- console.log(this.gender);
- }
- }
- class Person extends Human {
- constructor() {
- super();
- this.name = 'Max';
- this.gender = 'female';
- }
- printMyName() {
- console.log(this.name);
- }
- }
- //ES6
- // class Human {
- // gender = 'male';
- // printGender = () => {
- // console.log(this.gender);
- // }
- // }
- // class Person extends Human {
- // name = 'Max';
- // gender = 'Female';
- // printMyName = () => {
- // console.log(this.name);
- // }
- // }
- const person = new Person();
- person.printMyName();
- person.printGender();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement