336390
nodejs 这个接口里有句话不是明白,请大神解惑。 assert.deepStrictEqual(actual, expected[, message]) 这里有句话说:
Type tags of objects should be the same.
那问题来了,Type tags 是什么意思?
它文档里举了个例子, 说这2个对象不一样,是因为 type tags 不一样:
const date = new Date();
const fakeDate = {};
Object.setPrototypeOf(fakeDate, Date.prototype);
// Different type tags:
assert.deepStrictEqual(date, fakeDate);
// AssertionError: Input A expected to strictly deep-equal input B:
// + expected - actual
// - 2018-04-26T00:49:08.604Z
// + Date {}
我理解的 type tags 是 typeof date 返回的值,但是 typeof date 和 typeof fakeDate 结果都是 object ,所以我不明白 type tags 指的是什么?