Let's first discuss how variables declared, withvar and let are different. Both let and var are used to declare variables, that can be optionally initialized at the time of declaration. As per MDN: The var statement declares a function-scoped or globally-scoped variable, optionally initializing it to a value. The let…