+ 2

What difference between let and var?

23rd Jun 2016, 4:00 AM
Amarjit Dhillon
Amarjit Dhillon - avatar
6 Answers
+ 12
let can be used inside function and ...var can be used in any part of te code
26th Aug 2018, 2:06 PM
đź‘‘Mahesh Khatriđź‘‘
đź‘‘Mahesh Khatriđź‘‘ - avatar
+ 11
I think that let is for constants and var is for variables. Constants can't be changed. The value of a variable can be changed.
25th Jun 2016, 1:39 PM
Svetlana Milutinović
Svetlana Milutinović - avatar
+ 2
let is used to declare constants and var is used to declare variable. Constants are those whose value we can't change and variable are those whose value can be change as many times as we want.
9th Jul 2016, 2:57 PM
+ 1
yes you all are right
18th Jul 2016, 5:46 PM
Asif Siddique
Asif Siddique - avatar
Whenever we want to assign a fix value like value of pi, we use let keyword as constant so that the value cannot be overridden or get changed. If we want to put the value that will get changed later on, then we use var keyword for variable.
30th Jan 2017, 11:40 AM
Chinmay Joshi
Chinmay Joshi - avatar
27th Aug 2018, 7:49 AM
Einar B. Gilberg
Einar B. Gilberg - avatar