Home > Article > Web Front-end > 5 small examples that can help you understand JavaScript core closures and scope_javascript skills
Here are 5 small scripts that will help you truly understand the core of JavaScript – closures and scope. Before running the console, try answering what will pop up in each case. Then you can create a test file to check your answers. Are you ready?
1,
The answer is at the end of this article. Before reading the answer, do you dare to leave your guess?
Correct answer: 1. undefined 2. 1 3. function a(x){ return x * 2} 4. 10 5. [object window]