Main difference between var and let variable declaration is the “scope”.
var is scoped to the nearest function block
let is scoped to the nearest enclosing block, this scope can be smaller than a function block

Both types will have global scope if defined outside a function block, no difference work exactly same way