in运算符在JavaScript中的用法是什么?
in运算符用于JavaScript中检查对象中是否存在某一属性。
示例
可以尝试运行以下代码以学习如何在JavaScript中使用in运算符 −
<!DOCTYPE html>
<html>
<body>
<script>
var emp = {name:"Amit", subject:"Java"};
document.write("name" in emp);
document.write("<br>");
document.write("subject" in emp);
document.write("<br>");
document.write("MAX_VALUE" in Number);
document.write("<br>");
document.write("MIN" in Number);
</script>
</body>
</html>
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C语言程序
C++
C#
MongoDB
MySQL
Javascript
PHP