什么是 JavaScript 按位异或 (^) 运算符?
htmljavascriptprogramming scripts更新于 2026/1/13 10:20:17
如果两位不同,则使用按位或 (|) 运算符时返回 1。
示例
您可以尝试运行以下代码来了解如何使用 JavaScript 按位异或运算符。
<!DOCTYPE html>
<html>
<body>
<script>
document.write("Bitwise XOR Operator<br>");
// 7 = 00000000000000000000000000000111
// 1 = 00000000000000000000000000000001
document.write(7 ^ 1);
</script>
</body>
</html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

