日期:2014-05-16  浏览次数:20365 次

nodejs v8 实现 ECMA 5 Mozilla 的一些特性

当开发者写浏览器js时,一些很好内置函数有些浏览器实现了有些却没实现,这样导致程序员根本就不用这些函数。

如果你在玩nodejs,可以确定这的是这些好用的内置函数都被统一的实现,不需要自己一遍一遍自己实现。

?

下面的列出一些非常好用的api 片段?,这些方法在v8里内置实现了。

?

注意:v8 实现了ECMA?3 所有规范,但是仅仅实现了ECMA?5规范部分内容

?

语法扩展

?

?

var obj = { get a() { return "something" }, set a() { "do nothing" } }

?

?getter/setter? 方法定义

?

Array

  • Array.isArray(array)?– 数组判断.

Array.prototype

  • indexOf(value)?– Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
  • lastIndexOf(value)?– Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.