1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <!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>
- class Vase {
- constructor(name) {
- this.name = name;
- }
- music() {
- console.log("音乐课");
- }
- }
- class Year extends Vase {
- constructor(name,age) {
- super(name);
- this.age = age;
- }
- sport() {
- console.log("运动");
- }
- static run() {
- console.log("跑步")
- }
- }
- let a1 = new Vase("小明");
- let a2 = new Year("小红",18);
- console.log(a1,'a1');
- console.log(a2,'a2');
- console.log(Year.run());
- </script>
- </body>
- </html>
|