2018-10-19 10:55:20
var str1=new String('str1');
var str2='str2';
console.log(typeof str1);
console.log(typeof str2);
console.log(str1 instanceof String);
console.log(str2 instanceof String);
console.log(str1.constructor==String);
console.log(str2.constructor==String);
var a = ['hello','world'];
console.log(typeof a);
console.log(a.toString());
console.log(Object.prototype.toString.call(a));
console.log(Array.prototype.isPrototypeOf(a));
console.log(Array.isArray(a));
console.log(a instanceof Array);
console.log(a instanceof Object);
console.log(a.constructor==Array);
console.log(a.constructor==Object);
var b = {'hello':'world'};
console.log(typeof b);
console.log(b.toString());
console.log(Object.prototype.toString.call(b));
console.log(Object.prototype.isPrototypeOf(b));
console.log(b instanceof Object);
console.log(b.constructor==Object);
最后生成于 2023-06-18 18:31:06
热门推荐: