Logical OR Operator in JavaScript
Level 270 keystrokes
Uses the || operator to check if at least one condition is true.
JavaScript code
// Declare a variable with the boolean value true1let x = true;// Declare a variable with the boolean value false2let y = false;// || (OR) returns true if AT LEAST ONE value is true// true || false = true (one is true)3console.log(x || y);// false || false = false (neither is true)4console.log(y || y);Output
true false
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
;× 4|× 4.× 2(× 2)× 2=× 2