JavaScript 中的位或赋值运算符 (|=) 是什么?
它对右操作数与左操作数执行 OR 运算,并将结果赋值给左操作数。
示例
你可以尝试运行以下代码来学习如何使用位或赋值运算符 −
<html>
<body>
<script>
var a = 2; // Bit presentation 10
var b = 3; // Bit presentation 11
document.write("(a |= b) => ");
document.write(a |= b);
</script>
</body>
</html>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP