Javascript uses function as scope. Declare a function inside another function creates a different scope. Let’s look at the example code below.