Challenge - 5 Problems
JavaScript First Steps Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this JavaScript code?
Look at this code snippet. What will it print to the console?
Javascript
console.log('Hello, ' + 'world!');
Attempts:
2 left
💡 Hint
Remember how string concatenation works with the + operator.
✗ Incorrect
The + operator joins the two strings exactly as written, including the comma and space inside the first string.
❓ Predict Output
intermediate2:00remaining
What will this code output?
Check this code and choose the correct console output.
Javascript
let x = 5; console.log(x * 2);
Attempts:
2 left
💡 Hint
Multiplying a number by 2 doubles it.
✗ Incorrect
Variable x holds 5, so x * 2 equals 10, which is printed.
❓ Predict Output
advanced2:00remaining
What is the output of this code with a function?
What will this program print when run?
Javascript
function greet(name) { return `Hello, ${name}!`; } console.log(greet('Alice'));
Attempts:
2 left
💡 Hint
The function uses template strings to insert the name.
✗ Incorrect
The function greet returns a greeting with the name inserted. Calling greet('Alice') returns 'Hello, Alice!'.
❓ Predict Output
advanced2:00remaining
What does this code print?
Look at this code using let and const. What is the output?
Javascript
const greeting = 'Hi'; let name = 'Bob'; console.log(greeting + ', ' + name + '!');
Attempts:
2 left
💡 Hint
Variables greeting and name hold strings that are joined with commas and spaces.
✗ Incorrect
The + operator joins the strings exactly as written, including the comma and space.
❓ Predict Output
expert2:00remaining
What is the output of this code with asynchronous behavior?
What will this code print to the console?
Javascript
console.log('Start'); setTimeout(() => console.log('Middle'), 0); console.log('End');
Attempts:
2 left
💡 Hint
setTimeout with 0 delay still runs after the current code finishes.
✗ Incorrect
The synchronous console.log calls run first, printing 'Start' then 'End'. The setTimeout callback runs last, printing 'Middle'.