<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
class anima {
name = "xuhaitao234";
constructor(agee) {
this.age = agee;
}
getName() {
return this.name;
}
}
var p01 = new anima();
console.log(p01);
//------------------------------------------------------------
function animaa(agee) {
this.age = agee;
}
animaa.prototype.name = "xu taotao";
animaa.prototype.getName = function() {
return this.name;
}
var nnn = new animaa(89);
console.log(nnn);
</script>
</body>
</html>