Question · JavaScript and TypeScript course · Module 12: Functional Programming

Data Privacy with Closures

How do closures ensure data privacy in JavaScript?

Answer options

  • By encrypting variables
  • By using the private keyword
  • By compiling code to WebAssembly
  • By encapsulating variables in the function scope, inaccessible from outside

You can check the correct answer by solving this task in the CodeWorlds game.