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