In this example:
if(wasThatTrue){
return “Yes, that was true”;
}
return “No, that was false”;
If true doesn’t the program run the first bit of code and return “Yes, that was true”, but then also continue to the next line of code and run the next piece of code - return “No, that was false”.
What stops the program from stopping at the first line (return “Yes, that was true”)?
Your code so far
function trueOrFalse(wasThatTrue) {
// Only change code below this line
if(wasThatTrue){
return "Yes, that was true";
}
return "No, that was false"
};
// Only change code above this line
/*
function test(time){
if (time>8&&time<=13){
console.log("Day");
}
console.log("night");}
test(9)
*/
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
.
Challenge: Use Conditional Logic with If Statements
Link to the challenge: