W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript 比较</h1> <p>如果一个或两个表达式为 true,则 OR 运算符(||)返回 true,否则返回 false。</p> <p id="demo"></p> <script> var x = 6; var y = 3; document.getElementById("demo").innerHTML = (x == 5 || y == 5) + "<br>" + (x == 6 || y == 0) + "<br>" + (x == 0 || y == 3) + "<br>" + (x == 6 || y == 3); </script> </body> </html>