Private variable in class:

class Counter {
#count = 0; // cannot be access publicly get value () {
return this.#count;
} incremenet(){
this.#count++;
}
}

class field syntax:

Previously you need to call 'super'

class Animal {
constructor (name) {
this.name = name
}
} class Cat extends Animal {
constructor (name) {
super(name);
this.likesBaths = false;
}
meow () {
// ...
}
}

But now, we don't need to, you can use classs field:

class Animal {
constructor (name) {
this.name = name
}
} class Cat extends Animal {
likesBaths = false;
meow () {
// ...
}
}

Above two features are supported in latest Chrome and Node.js.

flatMap:

const duplicate = x => [x, x];
console.log([2,3,4].flatMap(duplicate)); // [2, 2, 3, 3, 4, 4]

Object.fromEntries:

Reverse opreation of Object.entries, it transform [['x', 42], ['y', 50]] too {x: 42, y: 50}:

const object = {x: 42, y: 50, abc: 9001}
const result = Object.fromEntries(
Object.entries(object)
.filter(([key, value]) => key.length === 1) // only take x, y, ingore abc
.map(([key, value]) => [key, value * 2])
) // {x: 84, y: 100}

It is also support to transform back and from Javascirpt Map.

globalThis:

using 'globalThis' to handle all the envs.

Intl:

最新文章

  1. Python练习,网络小爬虫(初级)
  2. C语言typedef的用法(转)
  3. .frame类库简单介绍与使用
  4. JSP-08-第三方控件的使用
  5. NKW
  6. Spring中依赖注入的使用和配置
  7. 解析php mysql 事务处理回滚操作(附实例)
  8. HDOJ2016数据的交换输出
  9. ubuntu下设置开机自启动项
  10. MongoDB学习笔记05
  11. 有关windows在调试ODOO8.0有些问题
  12. C# 与 C++强强联合--C#中的指针
  13. go defer笔记
  14. BASH 基本语法
  15. Linux开机执行指定shell
  16. pandas shift
  17. MATLAB中版本和日期函数
  18. 如何配置Linux系统防火墙,以防止DDOS攻击?
  19. [转]greenplum(postgresql)之数据字典
  20. CentOS忘记普通用户密码解决办法

热门文章

  1. [SDOI2013]直径 题解
  2. 解决Another app is currently holding the yum lock; waiting for it to exit...问题
  3. csp模拟赛低级错误及反思
  4. PHP+jQuery.photoClip.js支持手势的图片裁剪上传实例
  5. Codeforces 1238C. Standard Free2play
  6. maven 常见命令 学习笔记(一)之 -pl -am -amd
  7. (转载)项目中表、类、包、JSP命名规范
  8. python numpy 的用法—— bincount
  9. redis的keys常用操作及redis的特性
  10. Linux之用户相关操作