1 var str1=new String('str1'); 2 var str2='str2'; 3 console.log(typeof str1);// 4 console.log(typeof str2);//string 5 console.log(str1 instanceof String);//true 6 console.log(str2 instanceof String);//false 7 console.log(str1.constructor==String);//true 8 console.log(str2.constructor==String);//true 9 10 var a = ['hello','world']; 11 console.log(typeof a);// 12 console.log(a.toString());//hello,world 13 console.log( .prototype.toString.call(a));//[ Array] 14 console.log(Array.prototype.isPrototypeOf(a));//true 15 console.log(Array.isArray(a));//true 16 console.log(a instanceof Array);//true 17 console.log(a instanceof );//true 18 console.log(a.constructor==Array);//true 19 console.log(a.constructor== );//false 20 21 var b = {'hello':'world'}; 22 console.log(typeof b);// 23 console.log(b.toString());//[ ] 24 console.log( .prototype.toString.call(b));//[ ] 25 console.log( .prototype.isPrototypeOf(b));//true 26 console.log(b instanceof );//true 27 console.log(b.constructor== );//true
继续阅读与本文标签相同的文章
下一篇 :
Python前端开发之CSS
-
微服务架构到底是什么鬼?
2026-05-18栏目: 教程
-
Linux系统安全之Rootkit原理解析与检测实践
2026-05-18栏目: 教程
-
贯彻10项原则,构建Linux系统安全体系
2026-05-18栏目: 教程
-
从原理到代码,轻松深入逻辑回归模型!
2026-05-18栏目: 教程
-
直播行业的坑
2026-05-18栏目: 教程
