What is the difference between "var" and "let" Keywords?

Both are used for function declaration in JavaScript but the difference are given below :-

  let var
1. It can be only available inside the scope it's declared, like in for loop. It can be accessed outside the loop.
2. It is block scoped. It is function scoped

Suggest An Answer

No suggestions avaliable!

Latest post from Javascript interview questions

Ask Question