<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
class Logger {
constructor(a,b) {
this.a=a;
this.b=b;
}
print() {
console.log(text${this.a}
);
console.log(text${this.b}
);
}
}
const logger = new Logger(1,100);
logger.print();
</script>
</head>
<body>
<h1>我的第一个 JavaScript 程序</h1>
<p id="demo">这是一个段落</p>
<button type="button" onclick="displayDate()">显示日期</button>
</body>
</html>

网友评论