Mid JavaScript

Can you create a private variable using closure?

Yes. Variables inside the outer function cannot be accessed directly, only via inner

functions.

Example: See createCounter() above.

More from JavaScript Tutorial

All questions for this course