In JavaScript, Hoisting is the default behavior where variables and function declarations are moved to the top of their scope before code execution. No Matter where function and variable are declared, it moved up top on their own scope. Doing this, it allows us to call functions before even writing…