类型判断
(1)判断是不是数组
写法:Object.prototype.toString.call(对象) == '[object Array]'
var arr = []; alert( Object.prototype.toString.call(arr) == '[object Array]' ); //true
(2)判断是不是json
写法:Object.prototype.toString.call(对象) == '[object object]'
var arr = {}; alert( Object.prototype.toString.call(arr) == '[object object]' ); //true
(3)判断是不是时间
写法:Object.prototype.toString.call(对象) == '[object Date]'
var arr = new Date(); alert( Object.prototype.toString.call(arr) == '[object Date]' ); //true
(4)判断是不是正则
写法:Object.prototype.toString.call(对象) == '[object RegExp]'
var arr = new RegExp(); alert( Object.prototype.toString.call(arr) == '[object RegExp]' ); //true
(5)判断是不是空
写法:Object.prototype.toString.call(对象) == '[object Null]'
var arr = new null; alert( Object.prototype.toString.call(arr) == '[object Null]' ); //true