SLSkillLoop
JavaScript practice

JavaScript Output Practice

JavaScript output questions help you slow down and understand how the language evaluates code. Practice predicting results from small snippets before building larger features.

How to use JavaScript output practice

JavaScript output questions help you slow down around values and types. They are especially useful for learning how strings, arrays, booleans, arithmetic, and typeof behave in small snippets.

Predict the console output first, then compare it with the answer. If the result is surprising, write down whether the surprise came from type conversion, indexing, operator order, or a method call.

What to focus on
  • String concatenation and numeric operators
  • Array indexes and property access
  • Boolean values, typeof, and truthy strings

Example practice questions

Try these samples, then continue into the JavaScript Practice Labfor guided browser-based practice.

1

What does console.log(2 + 3 * 4) print?

Answer: 14

2

What does console.log('5' + 2) print?

Answer: 52

3

What does console.log([10, 20, 30][0]) print?

Answer: 10

4

What does console.log(Boolean('false')) print?

Answer: true

5

What does console.log('hello'.length) print?

Answer: 5

6

What does console.log(7 % 3) print?

Answer: 1

7

What does console.log(typeof 42) print?

Answer: number