<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
</body>
</html>
<script type="text/javascript">
class People{
constructor(name,age){
this.name=name;
this.age=age;
}
run(){
console.log(this.name+"正在跑步");
}
eat(){
console.log(this.name+"正在吃饭");
}
show(){
console.log(this.name+"今年"+this.age+"岁");
}
init(){
this.run();
this.eat();
this.show();
}
}
var obj=new People('tahirjan',26);
obj.init();
</script>
打开App,阅读手记