⚡ Predict the Output

JavaScript Output Questions
What Does This Code Print?

67+ real JavaScript output prediction questions from frontend interviews. Read code → predict console.log → learn why.

67 questions  ·  ✅ First 5 interactive free  ·  ✅ Progress saved in quiz

Practice Free →Browse Questions ↓

⚡ How to use this page

Try the first 5 questions here — click a question, type your prediction, check it. No account needed. The rest are in the interactive quiz where progress is tracked. Reading answers ≠ predicting them.

⚙️

Event Loop & Promises

22 questions

#01

Synchronous code runs before setTimeout

EasyEvent Loop & Promisesevent-loopsettimeout
#02

Promise microtask before setTimeout macrotask

MediumEvent Loop & Promisesevent-looppromise
#03

Promise chain passes values

MediumEvent Loop & Promisespromisechain
#04

Two Promise chains interleave in microtask queue

HardEvent Loop & Promisespromisemicrotask
#05

await suspends function — caller continues

MediumEvent Loop & Promisesasyncawait
#06

setTimeout fires in delay order

MediumEvent Loop & Promisessettimeoutorder
#07

Promise executor runs synchronously

MediumEvent Loop & Promisespromiseexecutor
#08

Nested setTimeout creates new macrotask

HardEvent Loop & Promisessettimeoutnested
#09

Promise.then is always async — even when resolved

MediumEvent Loop & Promisespromisemicrotask
#10

async function always returns a Promise

MediumEvent Loop & Promisesasyncpromise
#11

Multiple awaits — each is a microtask suspension

HardEvent Loop & Promisesasyncawait
#12

Promise.reject caught by .catch — chain continues

MediumEvent Loop & Promisespromisecatch
#13

Promise.all preserves order

MediumEvent Loop & Promisespromisepromise-all
#14

queueMicrotask runs before setTimeout

MediumEvent Loop & PromisesqueueMicrotaskmicrotask
#15

throw inside .then becomes rejection, caught by .catch

HardEvent Loop & Promisespromisethrow
#16

async try/catch catches awaited rejection

HardEvent Loop & Promisesasynctry-catch
#17

Deep Copy vs Shallow Copy in Promise Resolution

MediumEvent Loop & Promises
#18

Understanding Call Stack Flow with Nested Function Calls

EasyEvent Loop & Promises
#19

Deep Copy vs Shallow Copy with Promises

MediumEvent Loop & Promises
#20

Deep Copy and Shallow Copy in Asynchronous Operations

MediumEvent Loop & Promises
#21

Chaining Promises with Optional Chaining and Nullish Coalescing

HardEvent Loop & Promises
#22

Resolving Nested Promises with Optional Chaining and Nullish Coalescing

HardEvent Loop & Promises
🔒

Closures & Scope

13 questions

#23

Classic var in loop with setTimeout

EasyClosures & Scopeclosurevar
#24

let in loop — each iteration gets own binding

EasyClosures & Scopeclosurelet
#25

IIFE captures loop variable

MediumClosures & Scopeclosureiife
#26

Closure mutation persists across calls

MediumClosures & Scopeclosuremutation
#27

let block scope — inner does not leak

EasyClosures & Scopeletblock-scope
#28

var leaks out of block, let does not

EasyClosures & Scopevarlet
#29

Independent counter factory instances

MediumClosures & Scopeclosurefactory
#30

Closure captures binding not snapshot

MediumClosures & Scopeclosurereference
#31

var inside function shadows outer

MediumClosures & Scopevarhoisting
#32

Curried closure

MediumClosures & Scopeclosurecurrying
#33

Shared closure state across methods

HardClosures & Scopeclosureobject
#34

for...in includes inherited properties, for...of does not

HardClosures & Scopefor-infor-of
#35

Function is called with arguments object

HardClosures & Scopeargumentsrest
👉

'this' Binding

10 questions

#36

Method call — this is the calling object

Easy'this' Bindingthismethod
#37

Arrow function has no own this — inherits lexically

Easy'this' Bindingthisarrow
#38

bind permanently fixes this — call cannot override it

Medium'this' Bindingthisbind
#39

call vs apply — same result, different syntax

Medium'this' Bindingthiscall
#40

Arrow callback inside method preserves this

Medium'this' Bindingthisarrow
#41

Method chaining — return this

Medium'this' Bindingthischaining
#42

this in nested object — direct parent wins

Medium'this' Bindingthisnested
#43

bind with partial application

Hard'this' Bindingthisbind
#44

Class method loses this when destructured

Hard'this' Bindingthisclass
#45

new vs plain call — different returns

Hard'this' Bindingthisnew
🚀

Hoisting

7 questions

#46

var declaration hoisted as undefined

EasyHoistinghoistingvar
#47

Function declaration fully hoisted

EasyHoistinghoistingfunction-declaration
#48

Function expression not hoisted

EasyHoistinghoistingfunction-expression
#49

Local var shadows outer — from start of function

MediumHoistinghoistingvar
#50

Function declaration takes priority over var in hoisting

MediumHoistinghoistingfunction-declaration
#51

which function declaration wins?

MediumHoistinghoistingfunction-declaration
#52

var escapes block, let does not

HardHoistinghoistingvar
🔀

Type Coercion

15 questions

#53

Plus operator: string concat vs numeric add

EasyType Coercioncoercionplus
#54

Loose equality edge cases with null

MediumType Coercioncoercionequality
#55

typeof for common values

EasyType Coerciontypeofprimitives
#56

Truthy and falsy — empty array and object are truthy

MediumType Coercionbooleantruthy
#57

Unary plus converts to number

MediumType Coercioncoercionunary-plus
#58

null comparison inconsistency

HardType Coercioncoercioncomparison
#59

Short circuit: || vs ?? difference

EasyType Coercionshort-circuitor
#60

Object valueOf for arithmetic, toString for template

HardType CoercioncoercionvalueOf
#61

parseInt stops at first invalid character

MediumType CoercionparseIntradix
#62

String comparison is lexicographic

MediumType Coercioncoercioncomparison
#63

Array coercion with plus operator

HardType Coercioncoercionarray
#64

NaN is not equal to anything including itself

EasyType Coercionnanequality
#65

Object equality is reference-based

MediumType Coercionequalityreference
#66

String spread — unicode-safe character split

MediumType Coercionspreadstring
#67

JavaScript Optional Chaining and Nullish Coalescing

EasyType Coercion
🔒

62 more questions with progress tracking

Free accounts get 5 tracked questions. Pro unlocks all 67+ output questions, debug lab, theory mastery, and the leaderboard.

⚡ Start Free — 5 QuestionsView Pro — $9.99/mo →

Related Resources