源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <p>OR 操作符 (||) 如果一个或两个表达式为true,则返回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 === 5) + "<br>" + (x === 6 || y === 3); </script> </body> </html>
运行结果