Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

LEVEL 4 > LESSON 5 Javascript

let myvehicle = "car";
let weather = "rainy";

if (weather === "rainy")
{
if (myvehicle === "car")
{
console.log("I go to the office");
}
else if (myvehicle === "bike")
{
console.log("I Work from home");
}

}
else if (weather !== "rainy")
{
console.log("I go to the office");
}

Does anyone help me at this level?
by

3 Answers

NeelaPrasad
let myvehicle = "car";
let weather = "rainy";

if(weather=="rainy") //This line checks for weather is rainy or not if yes we enter into this block else we check else if condition
{
if(myvehicle == "car") //This line checks myvechicle is car or not
{
console.log("I go to the office");
}
else if(myvehicle == "bike") //if myvehicle is bike we will get the below text as output
{
console.log("I Work from home");
}

}
else if(weather!="rainy") //if weather is not rainy we will get the below text as output
{
console.log("I go to the office");
}
Allani65ft
if(weather == "rainy"){
{
if(myvehicle == "car")
{
console.log("I go to the office");
}
else if(myvehicle == "bike")
{
console.log("I Work from home");
}

}
}
else if(weather !== "rainy")
{
console.log("I go to the office");
}
Diegoye4no
Check out this way, some how worked with single quotes...

let myvehicle = "car";
let weather = "rainy";

if(weather == 'rainy') {

if(myvehicle == 'car')
{
console.log("I go to the office");
}
else if(myvehicle == 'bike')
{
console.log("I Work from home");
}

}
else if(weather !== 'rainy')
{
console.log("I go to the office");
}

Login / Signup to Answer the Question.