Hoisting is JavaScript concept which make JavaScript different from language Java. In Java every variable created in code have block level scope. Means if we have create any variable that will have its visibility limited into that block in which it was declared. So if we use variable above from…