Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (19 sloc) 507 Bytes

Challenge: Comparisons with the Logical Or Operator

The logical or operator (||) returns true if either of the operands is true. Otherwise, it returns false.

The pattern below should look familiar from prior Challenges:

if (num > 10) {
  return "No";
}
if (num < 5) {
    return "No";
}
return "Yes";

will return "Yes" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:

if (num > 10 || num < 5) {
  return "No";
}
return "Yes";
Something went wrong with that request. Please try again.