在 JavaScript 中 in 运算符的用法是什么?
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