<!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 Person {
constructor (name, age) {
this.name = name
this.age = age
}
sayHello () {
console.log('我的名字是:'+this.name+',我的年龄是:'+this.age);
}
}
const p = new Person('dzm', 18)
p.sayHello()
class Utils {
static sayHello () {
console.log('我的名字是:'+this.name+',我的年龄是:'+this.age);
}
}
Utils.sayHello()
</script>
</body>
</html>