ECMAScript 2019
以下新特性被加入 stage4
Object 的新 API
Array 的新 API
String 的新 API
JSON.stringify对 unicode 字符集进行优化
Object 的新 API
Object.fromEntries(iterable)
obj = { abc: 1, def: 2, ghij: 3 };
res = Object.fromEntries(
Object.entries(obj)
.filter(([ key, val ]) => key.length === 3)
.map(([ key, val ]) => [ key, val * 2 ])
);
// res is { 'abc': 2, 'def': 4 }Array 的新 API
Array.prototype.flat(depth)
Array.prototype.flatMap(fn)
String 的新 API
String.prototype.trimStart
String.prototype.trimEnd
JSON.stringify 对 unicode 字符集进行优化
JSON.stringify 对 unicode 字符集进行优化JSON.stringify 堆 no-bmp 字符的转义进行了优化
最后更新于