What is the difference between ‘var’ and ‘let’ keyword in JavaScript?

Please explain in Brief. 

Last updated:8/30/2019 3:43:21 AM

1 Answers

Anonymous User
Anonymous User

var let
’var’ keyword was introduced in JavaScript code from the beginning Stage itself. ‘let’ keyword is introduced in 2015 only.
’Var’ keyword has function scope. The variable defined with var is available anywhere within the function A variable declared with ‘let’ keyword has scope only within that block. So, let has a Block Scope.
The variable declared with ‘var’ be hoisted The variable declared with ‘let’ be hoisted

Answer