当前位置:网站首页>Use of ES6 class (class)
Use of ES6 class (class)
2022-07-22 05:52:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
class getMsg{
constructor(a,b){
this.x = a;
this.y = b;
}
getNum(){
return this.x * this.y
}
}
var num = new getMsg(2,3);
console.log(num); // getMsg {a: 2, b: 3}
console.log(num.getNum()); // 6
</script>
</body>
</html>
Copy code
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/107475.html Link to the original text :https://javaforall.cn
边栏推荐
猜你喜欢
这还不硬?你来打我!手把手教学!
[attack and defense world web] difficulty 1-star 3-point introductory questions: get, post, robots,, cookies, buttons, weak, PHP, web, serialize
Tensorflow入门教程(四十)——ACUNET
The relevant person in charge of the state Internet Information Office answered reporters' questions on the decision to impose administrative penalties related to network security review on didi Globa
2022长三角工业自动化展会将于10月在南京国际展览中心召开
【综合笔试题】难度 3.5/5,多解法热门二叉树笔试题
高校重金引进23名菲律宾博士,有关部门已展开调查!
文件操作管理
The United States is eager to develop 6G or revisit its old dream of collecting 3G patent fees, but China has taken the lead
ES6 from getting started to mastering 06: arrow function this direction and precautions
随机推荐
如何使用API接口批量查询图书信息?
The pit trodden by real people tells you to avoid the 10 mistakes that novices in automated testing often make
The darling of "all-optical" era - 400g optical module
【微信小程序授权】获取用户手机号,昵称
半导体产业动态杂谈
Document operation management
StringUtils 和 String 方法一览
使用yarn
爱奇艺抖音和好,微博躺枪?
详解SOAP简单对象访问协议
NOIPD2T2 – 宝藏 题解
关于Visual Studio 2019的前期详情
Postman - post请求application/json参数
记一次 .NET 某智能交通后台服务 CPU爆高分析
How to use API interface to batch query book information?
How to map the SSM framework file upload to the database
十大券商开户安全吗,风险大吗?
Relevant use cases of QT events
华为机试-题目核心考点
图片信息用浏览器显示:data:image/png;base64,+图片内容