javascript判断对象

时间:2023-03-08 20:14:09
 var assert = require('chai').assert;

 describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() { var obj = {};
var array = [];
var date = new Date(); var fn = function() {
} var _null = null; assert.equal('[object Object]', Object.prototype.toString.call(obj));
assert.equal('[object Array]', Object.prototype.toString.call(array));
assert.equal('[object Date]', Object.prototype.toString.call(date));
assert.equal('[object Function]', Object.prototype.toString.call(fn)); assert.equal('[object Null]', Object.prototype.toString.call(_null));
});
});
});

javascript判断对象