console.log()

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

This console.log() worksheet is part of the JavaScript Coding without HTML and CSS journey. Print it as a booklet?

console.log()

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Does console.log() print output to the console?
A No
B Yes
2. Is 'Console.log' with a capital C correct syntax?
A No
B Yes
3. Can console.log() print multiple values separated by commas?
A No
B Yes
4. Does console.log() require parentheses around its value?
A Yes
B No
5. Is 'console.print()' a real JavaScript method?
A No
B Yes

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1console.log("Hi!") AWrong - 'console' must be lowercase
2console.log(5 + 2) BPrints the result of 5 + 2
3The method used to print output to the console CWrong - the string is missing its closing quote
4Prints multiple values separated by commas Dconsole.log()
5Console.log("Hi"); EPrints "Hi!" to the console
6console.log("Hi); Fconsole.log(1, 2, 3)

Definitions

console.log()

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
___________("Hi!")
2.
console.___("Bye!")
3.
___________(5 + 2)
4.
console.___(score)
5.
___________(name)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Console.log("Hi");
B console.log("Bye");
C console.log(5);
Question 2
A consle.log("Yo");
B console.log(1);
C console.log(2);
Question 3
A console.log(1);
B console.log 2;
C console.log(3);
D console.log(4);
Question 4
A console.log("A");
B console.print("B");
C console.log("C");
D console.log("D");
Question 5
A let x = 1;
B console.log(x);
C console.log(x;
D let y = 2;
E console.log(y);

Answer Key

console.log()
Section A: Quick Questions
Q1
B — Yes
Q2
A — No
Q3
B — Yes
Q4
A — Yes
Q5
A — No
Section B: Match the Pairs
Q1
console.log("Hi!") → Prints "Hi!" to the console
Q2
console.log(5 + 2) → Prints the result of 5 + 2
Q3
The method used to print output to the console → console.log()
Q4
Prints multiple values separated by commas → console.log(1, 2, 3)
Q5
Console.log("Hi"); → Wrong - 'console' must be lowercase
Q6
console.log("Hi); → Wrong - the string is missing its closing quote
Section C: Definitions
Q1
console.log() — Prints a value or message to the browser or terminal console for debugging or output.
Section D: Fill in the Blanks
Q1
console.log("Hi!")
Q2
console.log("Bye!")
Q3
console.log(5 + 2)
Q4
console.log(score)
Q5
console.log(name)
Section E: Spot the Error
Q1
A — 'console' must be lowercase - a capital C causes an error.
Q2
A — 'console' is misspelled as 'consle'.
Q3
B — Missing parentheses around the value to print.
Q4
B — 'print' isn't a real console method - use 'log' instead.
Q5
C — Missing closing parenthesis before the semicolon.