Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- class Fruit{
- constructor(){
- this.taste = "Juicy";
- }
- printSomething(){
- console.log(this.taste);
- }
- }
- class Apple extends Fruit{
- constructor(){
- super()
- this.apple = "Apple";
- this.taste = "not Juicy";
- }
- letMeCallPrintSomething(){
- this.printSomething();
- }
- }
- boom = new Apple();
- boom.letMeCallPrintSomething();
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">class Fruit{
- constructor(){
- this.taste = "Juicy";
- }
- printSomething(){
- console.log(this.taste);
- }
- }
- class Apple extends Fruit{
- constructor(){
- super()
- this.apple = "Apple";
- this.taste = "not Juicy";
- }
- letMeCallPrintSomething(){
- this.printSomething();
- }
- }
- boom = new Apple();
- boom.letMeCallPrintSomething();</script></body>
- </html>
Add Comment
Please, Sign In to add comment