//1 判断构造函数 var arr = []; var obj = {}; var from = arr instanceof Array; console.log(from)//true var from = obj instanceof Array; console.log(from)//false var ofrom = obj instanceof Object; console.log(ofrom);//true //js里面万物皆对象,数组也是对象的一种,但是对象不是数组 //2,查询对象构造器 var arr = []; var from = arr.constructor; console.log(from);//ƒ Array() { [native code] } var obj = {}; var ofrom = obj.constructor; console.log(ofrom);//ƒ Object() { [native code] } function Person (){}; var person = new Person(); console.log(person.constructor);//ƒ Person (){} //3.使用 call 关键字调用 toString()方法 var arr = []; var obj = {}; var from = Object.prototype.toString.call(arr); console.log(from);//[object Array] var ofrom = Object.prototype.toString.call(obj); console.log(ofrom);//[object Object]