The result is the inverse of what I expected?


#1

https://www.codecademy.com/courses/learn-javascript-control-flow/lessons/control-flow/exercises/if-else-statements?action=lesson_resume&course_redirect=introduction-to-javascript


Because the variable isSoccerFan = false it should produce the output of “No goal!”



let isSoccerFan = false;

if (isSoccerFan = true) {
		console.log('Goal!')
} else {
  	console.log('No goal!');
}


#2

Use the comparison operator, ===, or, since the value is a boolean,

if (isSoccerFan) {

}

#3

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