如果这些位之一为1,则在使用按位或(|)运算符时将返回1。
您可以尝试运行以下代码,以了解如何使用JavaScript Bitwise OR运算符。
<!DOCTYPE html>
<html>
<body>
<script>
document.write("Bitwise OR Operator<br>");
//7 = 00000000000000000000000000000111-
//1 = 000000000000000000000000000000000000-
document.write(7 | 1);
</script>
</body>
</html>