let
,’ and ‘var
’ are used to declare the functions in JavaScript. The main difference in both of them is that ‘let
’ is block-scoped, whereas ‘var
’ is the functional scope. As variable is represented by ‘var
,’ and it is defined in the whole program in relation to ‘let
.’console.log(y);
var y=7;
console.log(y);
undefined 7
console.log(y);
let x=7; console.l
og(y);
Error