0
0
Javascriptprogramming~20 mins

Writing first JavaScript program - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
JavaScript First Steps Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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!');
AHello, world!
BHello,world!
CHello world!
DSyntaxError
Attempts:
2 left
💡 Hint
Remember how string concatenation works with the + operator.
Predict Output
intermediate
2:00remaining
What will this code output?
Check this code and choose the correct console output.
Javascript
let x = 5;
console.log(x * 2);
A10
B52
Cx * 2
Dundefined
Attempts:
2 left
💡 Hint
Multiplying a number by 2 doubles it.
Predict Output
advanced
2: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'));
Agreet(Alice)
BHello, name!
CHello, Alice!
DSyntaxError
Attempts:
2 left
💡 Hint
The function uses template strings to insert the name.
Predict Output
advanced
2: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 + '!');
AReferenceError
BHi, Bob!
Cgreeting, name!
DHi Bob!
Attempts:
2 left
💡 Hint
Variables greeting and name hold strings that are joined with commas and spaces.
Predict Output
expert
2: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');
A
Middle
Start
End
B
Start
Middle
End
C
End
Start
Middle
D
Start
End
Middle
Attempts:
2 left
💡 Hint
setTimeout with 0 delay still runs after the current code finishes.