博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
instanceof运算符_JavaScript instanceof运算符
阅读量:2502 次
发布时间:2019-05-11

本文共 662 字,大约阅读时间需要 2 分钟。

instanceof运算符

The JavaScript instanceof operator returns true if the first operand is an instance of the object passed on the right, or one of its ancestors in its prototype chain.

如果第一个操作数是在右侧传递的对象的实例或其原型链中的祖先之一,则JavaScript instanceof运算符将返回true。

In this example you can see that the myCar object, of class Fiesta, responds true to instanceof Fiesta, and also responds true to instanceOf Car, because Fiesta extends Car:

在此示例中,您可以看到Fiesta类的myCar对象对Fiesta的instanceof Fiesta响应为true,并且对instanceOf Car响应为true,因为Fiesta扩展了Car:

class Car {}class Fiesta extends Car {}const myCar = new Fiesta()myCar instanceof Fiesta //truemyCar instanceof Car //true

翻译自:

instanceof运算符

转载地址:http://aaqgb.baihongyu.com/

你可能感兴趣的文章
Java 浮点运算
查看>>
线程安全
查看>>
Centos7安装tomcat8
查看>>
MySQL基本命令和常用数据库对象
查看>>
poj 1222 EXTENDED LIGHTS OUT(位运算+枚举)
查看>>
秘密:之所以不搞军事同盟,俄罗斯
查看>>
µC/OS-II版本升级指南
查看>>
hibernate中持久化对象的生命周期(三态:自由态,持久态,游离态 之间的转换)...
查看>>
postgres出现Server doesn't listen错误解决办法
查看>>
linux shell学习--awk练习
查看>>
敏捷开发一千零一问系列之十二:敏捷实施的步骤?
查看>>
TCP三次握手机制中的seq和ack
查看>>
java内部类的定义原则
查看>>
2017年11月26日 C#流&&窗体对话框
查看>>
endl与\n的区别
查看>>
进程和线程概念及原理
查看>>
Dubbo超时重试机制带来的数据重复问题
查看>>
注解配置里的几个注解
查看>>
使ie678支持css3伪类选择器的插件
查看>>
题解报告:hdu 1212 Big Number(大数取模+同余定理)
查看>>