Javascript might seem like a pretty approachable programming language to most people, however certain concepts can prove quite tricky for beginners. One of the most commonly brought-up topics is that of and what are, so in this artile I will try to introduce these concepts in a beginner-friendly way. variable scope closures Scope When we talk about , we mean the visibility of one or more entities to certain parts of our code. For the purposes of this article, our entities are going to be limited to variables. scope There are two types of scope in Javascript: and . global local is pretty straightforward: Any variable defined outside any function or curly braces is part of the global scope and can be accessed from anywhere in the code. Global scope is slightly more complicated. Any variable defined inside a declaration or curly braces can only be accessed inside the function or block of code it was declared respectively. Local scope function Okay, this is basically all you need to know about variable scope. Let’s look at some simple examples: Block scope and definitions using and might seem slightly confusing at first, but I recommend you read (3 min read) and carefully study to clear up any remaining questions and doubts. var let A guide to Javascript variable hoisting with let and const MDN’s documentation of the [let](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) keyword _New JavaScript developers often have a hard time understanding the unique behaviour of variable/function hoisting._medium.freecodecamp.org A guide to JavaScript variable hoisting 🚩 with let and const Closures are one of those things that might seem confusing at first, but really aren’t. A function defined inside another function is a closure. Closures are particularly useful when you want to access a variable defined inside a function’s scope from outside the function. Closures A practical use of closures could be defining a public set of functions that can get or set some private variables inside a function (which is a pretty common use-case in object-oriented programming). Here’s a pretty simple example of closures in action: Summing up refers to a variable’s accessibility. It can either be public (defined outside any functions and curly braces and accessible anywhere in the code) or local (defined inside a function or block and accessible only inside said function or block). are functions defined inside other functions and can be used to access a function’s private variables from outside its own scope. Scope Closures