object is_Object is()方法

object is

This method was introduced in ES2015. It aims to help comparing values.

ES2015中引入了此方法。 它旨在帮助比较价值。

Usage:

用法:

Object.is(a, b)

The result is always false unless:

结果始终为false除非:

  • a and b are the same exact object

    ab是相同的精确对象

  • a and b are equal strings (strings are equal when composed by the same characters, in the same order)

    ab是相等的字符串(当由相同的字符以相同的顺序组成时,字符串是相等的)

  • a and b are equal numbers (numbers are equal when their value is equal)

    ab是相等的数字(数值相等时数字相等)

  • a and b are both undefined, both null, both NaN, both true or both false

    abundefined ,都为null ,都为NaN ,都为true或均为false

0 and -0 are different values in JavaScript, so pay attention in this special case (convert all to +0 using the + unary operator before comparing, for example).

0-0是JavaScript中的不同值,因此请注意这种特殊情况(例如,在进行比较之前,使用+一元运算符将所有值转换为+0 )。

翻译自: https://flaviocopes.com/javascript-object-is/

object is

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值