首页 > 编程语言 > 详细

《深入理解JavaScript》—— ECMAScript5 新特性

时间:2016-10-22 20:36:44      阅读:207      评论:0      收藏:0      [点我收藏+]

(1) 标准库的新功能

1. 元编程

① 获取和设置原型

—— Object.create()

—— Object.getPrototypeOf()

② 通过属性描述符管理属性特性

—— Object.defineProperty()

—— Object.defineProperties()

—— Object.create()

—— Object.getOwnPropertyDescriptor()

③ 列出属性

—— Object.keys()

—— Object.getOwnPropertyNames()

④ 保护对象

—— Object.preventExtensions()

—— Object.isExtensible()

—— Object.seal()

—— Object.isSealed()

—— Object.freeze()

—— Object.isFrozen()

(2) 新方法

① 新方法 String.prototype.trim()

② 通过方括号访问字符

③ 新数组方法

—— Array.isArray()

—— Array.prototype.every()

—— Array.prototype.some()

—— Array.prototype.filter()

—— Array.prototype.forEach()

—— Array.prototype.indexOf()

—— Array.prototype.lastIndexOf()

—— Array.prototype.map()

—— Array.prototype.reduce()

④ 新Date方法

—— Date.now()

—— Date.prototype.toISOString()

(3) JSON

支持JSON。

—— JOSN.parse()

—— JOSN.stringify()

—— 一些内建对象具有特殊的toJSON方法:

Boolean.prototype.toJSON()

Number.prototype.toJSON()

String.prototype.toJSON()

Date.prototype.toJSON()

《深入理解JavaScript》—— ECMAScript5 新特性

原文:http://www.cnblogs.com/luohaoran/p/5988063.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!