JS
challenger
Home
Intermediate JavaScript
functions II
Closure: make a counter
Closure: make a counter
Build a function that returns another function. Each call to the returned function should increment and return a counter that lives inside the outer function.
Premium
reset
function greet(name) { return `Hello, ${name}!`; } console.log(greet("Erik"));
JavaScript
Run Code
Console