欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Object.prototype.toString.call(obj)

程序员文章站 2022-04-19 18:21:41
...
<script type="text/javascript">
        var arr=[1,2,3];
        var obj=new Object();
        var str="hello";
        console.log(Object.prototype.toString.call(arr));
        console.log(Object.prototype.toString.call(obj));
        console.log(Object.prototype.toString.call(str));
        console.log(arr.toString());
        /*
          [object Array]
          [object Object]
          [object String]
          1,2,3
        */
    </script>

typeof arr;
A instanceof B;
a.constructor=A;

https://www.cnblogs.com/youhong/p/6209054.html