What is the main difference between var and let keywords in JavaScript?
Options:
Explanation:
The
var and
let keywords are both used for variable declaration in JavaScript. But, the main difference between them is that
var defines function scoped variable while
let defines block-scoped variable.
Tags:
JavaScript
Answer:
What is the main difference between var and let keywords in JavaScript var defined function scoped variable while let define block scoped variable.