Code game · JavaScript

Output Guess

Read the code and pick what it prints. Some questions look easy, but many hide a trap that catches experienced developers.

Level 1

What does this print?

Why practise JavaScript output questions?

"What will this code print?" is one of the most common questions in coding interviews and campus placements. It checks whether you really understand how the language behaves, not just whether you can memorise syntax.

These levels cover the ideas that trip people up most often: type conversion (why 2 + "2" is "22"), floating-point numbers, references vs copies, var vs let, sorting, automatic semicolons and the event loop (promises vs setTimeout).

Tip: when you get one wrong, open your browser console (F12) and run the code yourself. Changing it a little and running it again is the fastest way to learn.