js的数据类型分析1

js的数据类型分析一

摘自ECMA-262规范

Primitive Value
A primitive value is a member of one of the types Undefined, Null, Boolean, Number, or String. A
primitive value is a datum that is represented directly at the lowest level of the language implementation.

js有5种原始数据类型:Undefined,Null,Boolean,Number,String.

注意:第一个字母为大写。

A primitive value is a member of one of the following built-in types: Undefined, Null, Boolean, Number, and String; an object is a member of the remaining built-in type Object; and a method is a function associated with an object via a property

以上5种原始值为5种内置类型,剩下一种内置类型为object,注意此处为小写;方法是一个函数(对象的一个属性)。

These built-in objects include the Global object, the Object object, the Function object, the Array object,
the String object, the Boolean object, the Number object, the Math object, the Date object, the RegExp
object and the Error objects Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError
and URIError.

内置object包括:Global ,Object ,Funtion,Array,String,Boolean,Number,Math,Date,RegExp,另外还有一些Error object。

这里的String,Boolean,Number为内置对象,不要和上面的内置type混淆了。