引用类型
引用类型的值(对象)是引用类型的一个实例。在ES中,引用类型是一种数据结构,用于将数据与功能组织在一起。它也常被称为类,但这种称呼并不妥当。尽管ES从技术上讲是一门面向对象的语言,但他不具备传统的面向对象语言所支持的类和接口等基本结构。引用类型有时候也被称为对象定义,因为他们描述的是一类对象所具有的属性和方法。

1.Object类型
到目前为止,我们看到的大多数引用类型值都是Object类型的实例;而且Object也是ES中使用最多的一个类型。虽然Object的实例不具备多少功能,但对于在应用程序中存储和传输数据而言,它们确实是非常理想的选择。




2.Array类型
虽然ES数组与其他语言中的数组都是数据的有序列表,但与其他语言不同的是,ES数组的每一项可以保存任何类型的数据。且ES数组的大小是可以动态调整的,即可以随着数据的添加自动增长以容纳新增数据。





(1)检测数组
确定某个对象是不是数组:使用instanceof操作符;Array.isArray()方法


(2)转换方法



(3).栈方法
ES数组也提供了一种让数组的行为类似于其他数据结构的方法。具体说来,数组可以表现得像栈一样,后者是一种可以限制插入和删除项的数据结构。ES为数组提供的push()和pop()方法,实现了类似栈的插入、移除(增加、删除;推入、弹出)
push()方法:可接收任意数量的参数,把它们逐个添加到数组末尾,并返回修改后数组的长度
pop()方法:从数组末尾移除最后一项,减少数组的length值,然后返回移除的项

(4).队列方法
队列在列表的末端添加项,从列表的前端移除项。
shift()方法:能移除数组中的第一个项并返回该项,同时将数组长度减1。
结合push()方法,就能实现队列了。

unshift()方法:能在数组前端添加任意个项并返回新数组的长度。
结合pop()方法能从相反方向来实现队列。
(5).重排序方法
reverse()方法:反转数组项的顺序

sort()方法
(6).操作方法
concat()方法:基于当前数组中的所有项创建一个新数组
slice()方法:基于当前数组中的一或多个项创建一个新数组
splice()方法

(7).位置方法
indexOf():从前往后查找
lastIndexOf():从后往前查找
(8).迭代方法

(9).归并方法
reduce():从数组的第一项开始,逐个遍历到最后
reduceRight():从数组的最后一项开始,逐个遍历到最前
3.Date类型

Date.parse()
Date.UTC()
(1)继承的方法

(2)日期格式化方法
(3)日期、时间组件方法
4.RegExp类型
5.Function类型
6.基本包装类型
7.单体内置对象