var obj = {}; obj.isObject = function (obj) { return Object.prototype.toString.call(obj) == '[object Object]'; }; obj.isArray = function (array) { return Object.prototype.toString.call(array) == '[object Array]'; }; obj.isFunction = function (fun) { return Object.prototype.toString.call(fun) == '[object Function]'; }; //调用 console.log(obj.isObject({})); console.log(obj.isArray([])); console.log(obj.isFunction(function () { }));