Closure Over Configuration
Closure Over Configuration
A closure forms when an inner function keeps access to a variable from an outer function. The outer function may finish, but the returned function can still read the variables it closed over.
This is useful when one setup value should be reused across many later calls. The setup call stores the configuration; the returned function applies it.
Your task: Complete makeGreeter so it receives a greeting and returns a function. The returned function should receive a name and return a greeting for that name.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
Closure Over Configuration
A closure forms when an inner function keeps access to a variable from an outer function. The outer function may finish, but the returned function can still read the variables it closed over.
This is useful when one setup value should be reused across many later calls. The setup call stores the configuration; the returned function applies it.
Your task: Complete makeGreeter so it receives a greeting and returns a function. The returned function should receive a name and return a greeting for that name.