类的表达式写法2种写法
时间:7年前 阅读:5656
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
// class dd{
// constructor(){
// this.color = '颜色';
// this.size = '尺寸';
// }
// }
// 类的表达式写法(类的另一种(第2种写法))
let a = class dd{
constructor(){
this.color = '颜色';
this.size = '尺寸';
}
}
// let syu = new dd();
let syu = new a();
// 输出结果: 颜色
console.log(syu.color);
</script>
</body>
</html>
本站声明:网站内容来源于网络,如有侵权,请联系我们https://www.qiquanji.com,我们将及时处理。
微信扫码关注
更新实时通知

网友评论