Not understanding why this won't print


#1

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

So I’m really not understanding what I’m doing wrong here. This looks like it all checks out, but nothing gets printed to the output??? With how I wrote it, it’s supposed to print ‘We can eat later!’ right? But it’s just blank- no error or anything. The only hint I get asks if I created the if/else statement and whether or not I set hungerLevel to the right value.

```

let hungerLevel = 5;
if (hungerLevel > 7) {
console.log=(‘Time to Eat!’);
} else {
console.log=(‘We can eat later!’);
}


#2

.log is method, not a variable. The above overwrites it in the namespace so you will need to refresh the page to restore JavaScript to normal.

Eg.

console.log("some text");

console.log(someVariable);

console.log(__some_expression__);

#3

Ohhh I see. Thank you haha


#4

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