This forum is now read-only. Please use our new forums! Go to forums
help for variables 5.5
it keeps saying i didnt log anything in! if (1+1==2) {console.log=(‘I finished the first course!’)} else {console.log=(‘I lost the game’)}
Answer 55644cc6d3292fa67f00063a
console.log is a function call, you’ll soon learn what that means so far just keep in mind that it requires the () directly after it. What you did here is that you’ve overwritten console.log by a value. If you look closely you could see that:
console.log=('I finished the first course!')
this assigns ‘I finished the first course!’ to the variable console.log :( If you’d still have a console.log feature you could even see it. So the first thing you need to do is to get rid of the = sign between console.log and the (). But unfortunately this alone will not work either. The problem is that the value of console.log is still “‘I finished the first course!’” so it will give you an error telling you that it is not a function. To get rid of this just refresh the page, then the javaScript is loaded again and the default value are reset.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency