Guest User

Untitled

a guest
Jul 11th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. class Fruit{
  12. constructor(){
  13. this.taste = "Juicy";
  14. }
  15.  
  16. printSomething(){
  17. console.log(this.taste);
  18. }
  19. }
  20.  
  21. class Apple extends Fruit{
  22. constructor(){
  23. super()
  24. this.apple = "Apple";
  25. this.taste = "not Juicy";
  26. }
  27.  
  28. letMeCallPrintSomething(){
  29. this.printSomething();
  30. }
  31. }
  32.  
  33. boom = new Apple();
  34. boom.letMeCallPrintSomething();
  35. </script>
  36.  
  37.  
  38.  
  39. <script id="jsbin-source-javascript" type="text/javascript">class Fruit{
  40. constructor(){
  41. this.taste = "Juicy";
  42. }
  43.  
  44. printSomething(){
  45. console.log(this.taste);
  46. }
  47. }
  48.  
  49. class Apple extends Fruit{
  50. constructor(){
  51. super()
  52. this.apple = "Apple";
  53. this.taste = "not Juicy";
  54. }
  55.  
  56. letMeCallPrintSomething(){
  57. this.printSomething();
  58. }
  59. }
  60.  
  61. boom = new Apple();
  62. boom.letMeCallPrintSomething();</script></body>
  63. </html>
Add Comment
Please, Sign In to add comment