Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. //JS_Practice
  2.  
  3. // function printMyName(name) {
  4. // console.log(name);
  5. // }
  6. // const multiply = (number) => {
  7. // return number*2;
  8. // }
  9. // console.log(multiply(2));
  10.  
  11. class Human {
  12. constrctor() {
  13. this.gender= 'male';
  14. }
  15. printGender() {
  16. console.log(this.gender);
  17. }
  18. }
  19.  
  20. class Person extends Human {
  21. constructor() {
  22. super();
  23. this.name = 'Max';
  24. this.gender = 'female';
  25. }
  26. printMyName() {
  27. console.log(this.name);
  28. }
  29. }
  30.  
  31. //ES6
  32. // class Human {
  33. // gender = 'male';
  34. // printGender = () => {
  35. // console.log(this.gender);
  36. // }
  37. // }
  38.  
  39. // class Person extends Human {
  40. // name = 'Max';
  41. // gender = 'Female';
  42.  
  43. // printMyName = () => {
  44. // console.log(this.name);
  45. // }
  46. // }
  47.  
  48. const person = new Person();
  49. person.printMyName();
  50. person.printGender();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement