We also refer to the function body as a _closure_. A closure is any piece of source code (most commonly, a function) that refers to some variables, and the closure "remembers" these variables even when the scope in which these variables were declared has exited. ## [Function scopes and closures](#function_scopes_and_closures) Functions form a [scope](/en-US/docs/Glossary/Scope) for variables—this means variables defined inside a function cannot be accessed from anywhere outside the function. The function scope inherits from all the upper scopes. For example, a function defined in the global scope can access all variables defined in the global scope. A function defined inside another function can also access all variables defined in its parent function, and any other variables to which the parent function has access. On the other hand, the parent function (and any other parent scope) does _not_ have access to the variables and functions defined inside the inner function. This provides a sort of encapsulation for the variables in the inner function. js ``` // The following variables are defined in the global scope const num1 = 20; const num2 = 3; const name = "Chamakh"; // This function is defined in the global scope function multiply() { return num1 * num2; } console.log(multiply()); // 60 // A nested function example function getScore() { const num1 = 2; const num2 = 3; function add() { return `${name} scored ${num1 + num2}`; } return add(); } console.log(getScore()); // "Chamakh scored 5" ```