Challenge - 5 Problems
Console Log Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of console.log with template literals
What is the output of this code?
const name = "Alice";
const age = 30;
console.log(`Name: ${name}, Age: ${age}`);Javascript
const name = "Alice"; const age = 30; console.log(`Name: ${name}, Age: ${age}`);
Attempts:
2 left
💡 Hint
Look how template literals use ${} to insert variables inside backticks.
✗ Incorrect
The template literal replaces ${name} and ${age} with their variable values inside the string.
❓ Predict Output
intermediate2:00remaining
Output of console.log with multiple arguments
What will this code print?
console.log("Hello", "World", 2024);Javascript
console.log("Hello", "World", 2024);
Attempts:
2 left
💡 Hint
console.log prints each argument separated by spaces.
✗ Incorrect
console.log prints all arguments separated by spaces without quotes.
❓ Predict Output
advanced2:00remaining
Output of console.log with undefined variable
What happens when you run this code?
let x; console.log(x);
Javascript
let x; console.log(x);
Attempts:
2 left
💡 Hint
Variables declared but not assigned have a special value.
✗ Incorrect
A declared variable without a value is undefined in JavaScript.
❓ Predict Output
advanced2:00remaining
Output of console.log with object and array
What will this code print?
const obj = {a: 1, b: 2};
const arr = [3, 4];
console.log(obj, arr);Javascript
const obj = {a: 1, b: 2}; const arr = [3, 4]; console.log(obj, arr);
Attempts:
2 left
💡 Hint
console.log prints objects and arrays in readable form separated by spaces.
✗ Incorrect
console.log prints the object and array as their readable forms separated by space.
🧠 Conceptual
expert3:00remaining
Behavior of console.log with asynchronous code
What is the output order of this code?
console.log('Start');
setTimeout(() => console.log('Timeout'), 0);
console.log('End');Javascript
console.log('Start'); setTimeout(() => console.log('Timeout'), 0); console.log('End');
Attempts:
2 left
💡 Hint
setTimeout with 0 delay runs after current code finishes.
✗ Incorrect
The synchronous logs run first, then the setTimeout callback runs after the current call stack is empty.