0
0
Javascriptprogramming~5 mins

Output using console.log in Javascript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AStops the program
BSaves 'Hi!' to a file
CPrints 'Hi!' to the console
DShows a popup message
Which is the correct way to print the number 10?
Aconsole.log('10');
Bconsole.log(10);
Cconsole.print(10);
Dprint.console(10);
What will console.log(4 * 5); output?
A20
B45
C9
DError
How do you print the value of a variable name?
Aconsole.print(name);
Bconsole.log('name');
Cprint(name);
Dconsole.log(name);
Which of these is NOT true about console.log()?
AIt can create popup alerts
BIt can print numbers
CIt can print variables
DIt can print strings
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.