If else with two conditions


My Code - this is working fine.

var moonPhase = "full";
var foggyNight = false;
if (moonPhase === "full" || foggyNight) {
} else if (moonPhase === "mostly full")  {
  console.log("Arms and legs are getting hairier");
} else if (moonPhase === "mostly new") {
  console.log("Back on two feet");
} else {
  console.log("Invalid moon phase");

But if I use extra brackets for easy understanding, I am getting an error message.

if ((moonPhase === "full") || (foggyNight)) {

Can someone please help me understand the issue?


Is the error from the SCT or the console?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.