NEWNew questions added!Explore now

The learning platform for engineers

Navigate technical interviews with ease

Articles, a question bank, and quizzes - track streaks, XP, and progress on one Dashboard.

710 practice items - updated regularly

7-day streak
12 solved today
+120 XP
JavaScriptEasy#closures

What is a closure in JavaScript?

Hide answer

Answer

A closure keeps a reference to outer-scope variables even after that function has returned.

JavaScriptEasy1/12

Reverse a string

Examples

Write reverse so that the following cases hold.

  1. Inputreverse("hello")
    Output"olleh"
  2. Inputreverse("FrontendPro")
    Output"orPdnletnorF"

Answer

sandbox.js

Output

olleh

Product tour

Content demo

Switch between articles, questions, and quizzes - click a card to explore.

By the numbers

Huge question bank

Every format you need - with answers and difficulty tags.

306questions
330quizzes
74articles
37hours est.

Platform

Platform highlights

Practice in an environment that feels like the real app - no setup.

72%
Easy
48%
Med
24%
Hard
JavaScript18/25React12/20CSS9/15
4-week activity

Visual progress

Difficulty rings, topic groups, and activity heatmap.

Basic

What is a closure in JavaScript?

Reveal answer
Answer

A closure keeps references to outer variables even after the outer function returns.

Practice in-browser

Reveal answers, run quizzes, and mark completion instantly.

7-day streakToday's goal
+120 XPThis week
Level 368% to Level 4
  • 1You1,240 XP
  • 2Alex1,180 XP
  • 3Sam1,050 XP

Streaks & XP

Daily goals, levels, and a weekly leaderboard.