Recall & Review
beginner
What does
console.log() do in JavaScript?console.log() prints messages or values to the browser's console. It's like writing a note to yourself to check what your program is doing.
Click to reveal answer
beginner
How do you print the text "Hello, world!" using
console.log()?Use console.log('Hello, world!'); to show the message in the console.
Click to reveal answer
beginner
Can
console.log() print numbers and variables?<p>Yes! You can print numbers like <code>console.log(123);</code> or variables like <code>let x = 5; console.log(x);</code>.</p>Click to reveal answer
beginner
What will this code print?<br>
console.log(2 + 3);
It will print 5 because it adds the two numbers and shows the result.
Click to reveal answer
beginner
Why is
console.log() useful when learning to code?It helps you see what your program is doing step-by-step, like checking your work on a homework problem.
Click to reveal answer
What does
console.log('Hi!'); do?✗ Incorrect
console.log() prints messages to the console, so it will show 'Hi!'.
Which is the correct way to print the number 10?
✗ Incorrect
Use console.log(10); to print the number 10 as a number, not as text.
What will
console.log(4 * 5); output?✗ Incorrect
It multiplies 4 by 5 and prints 20.
How do you print the value of a variable
name?✗ Incorrect
Use console.log(name); to print the variable's value, not the word 'name'.
Which of these is NOT true about
console.log()?✗ Incorrect
console.log() prints to the console, it does not create popup alerts.
Explain how
console.log() helps you see what your JavaScript program is doing.Think about how you check your work when solving a problem.
You got /4 concepts.
Describe how to use
console.log() to print a variable and a message together.Try combining text and variables inside console.log.
You got /4 concepts.