标签:变量 turn tostring call == color ret cal style
var arr= [1,2,3,4]; function isArray(o) { return Object.prototype.toString.call(o)== ‘[object Array]‘; } console.log(isArray(arr));
//Object.prototype.toString.call([]) ‘[object Array]‘
//Object.prototype.toString.call({}) ‘[object Object]‘
//Object.prototype.toString.call(1) ‘[object Number]‘
//Object.prototype.toString.call(‘1‘) ‘[object String]‘
//Object.prototype.toString.call(null) ‘[object Object]‘
//Object.prototype.toString.call(undefined) ‘[object Undefined]‘
标签:变量 turn tostring call == color ret cal style
原文地址:https://www.cnblogs.com/peter-web/p/13168042.html