账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    nodejs 里 Type tags 指的是什么?
    40
    0

    nodejs 这个接口里有句话不是明白,请大神解惑。
    [assert.deepStrictEqual(actual, expected[, message])](https://nodejs.org/dist/lates...
    这里有句话说:

    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 指的是什么?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 共 0 条
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部