博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JavaScript公共类字段
阅读量:2502 次
发布时间:2019-05-11

本文共 393 字,大约阅读时间需要 1 分钟。

In the past, to create a public class field we would have used this syntax, instantiating the field in the constructor:

过去,要创建一个公共类字段,我们将使用以下语法,在构造函数中实例化该字段:

class Counter {  constructor() {    this.count = 0  }}

The new , which you can use since Chrome 72 and Node 12, allows us to use this syntax:

从Chrome 72和Node 12开始可以使用的新 ,使我们可以使用以下语法:

class Counter {  count = 0}

Much simpler!

简单得多!

翻译自:

转载地址:http://ylqgb.baihongyu.com/

你可能感兴趣的文章
自然语言工程师要求
查看>>
Leetcode 452.用最少数量的箭引爆气球
查看>>
【转】Linux设备驱动之Ioctl控制
查看>>
实例说明>
查看>>
日常理财
查看>>
ng-bind-html在ng-repeat中问题的解决办法
查看>>
制定document.getElementByClassName()
查看>>
UVA-315 无向图求割点个数
查看>>
Python学习_4_购物车
查看>>
ubuntu开机自启动
查看>>
【WXS数据类型】Number
查看>>
canvas学习笔记 ---- 1
查看>>
纪念开博客的第一天_(:з」∠)_
查看>>
WechatHelper
查看>>
测试SDWebImage淡入淡出效果在UITableView中的重用显示问题
查看>>
[控件] ChangeColorLabel
查看>>
将位图导入为ArcGIS面要素
查看>>
前自增和后自增的区别
查看>>
Linux 基本操作
查看>>
ManagementClass("Win32_Share")之共享目录
查看>>