Number 类型
Number() \ isNaN() \ isFinite() \ parseInt( , ) \ parseFloat()
(23).toFixed(2); // 直接量 括号必须
NumberObj.toFixed(2);
Number(""); // 0
Number("123NN"); //Nan
parseInt("123NN", 10); // 123
String 类型
toString \ String(); String() 先调用 toString,参数变量(null undefined)没有 toString 方法,返回字面量
var a, b=null;
console.log( String(a) ); // "undefined"
console.log( String(b) ); // "null"
Object 类型
Object :
constructor
hasOwnProperty(propertName)
isPrototypeOf(object)
propertyIsEnumerable(propertName)
toLocaleString()
toString()
valueOf()
比较操作:
NaN == 任意 : false;
null == null : true;
undefined == undefined : true;
null == undefined : true;
null == 任意 :false;
undefined == 任意 :false;
object == 0; false; // (未重写方法) object 调用 valueOf (和 toString) 为字符串 "[object Object]",再转数值为 NaN
var aa = { };
aa == "[object Object]"; // true
<!-- 伪数组 -->
伪数组
判断是不是真数组:
1、数据 instanceof Array
2、Object.prototype.toString.call( 数据 ) === '[object Array]'
var divs = document.getElementsByTagName("div"); // 伪数组
divs = Array.prototype.slice.call(divs);// 数组
console.log(divs.length);