Declaring Variables Using let

Modern JavaScript Learn JavaScript Fundamentals
1 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.78
List Price:  €120.09
You save:  €34.31
£74.57
List Price:  £104.41
You save:  £29.83
CA$137.96
List Price:  CA$193.15
You save:  CA$55.19
A$153.09
List Price:  A$214.33
You save:  A$61.24
S$128.82
List Price:  S$180.35
You save:  S$51.53
HK$780.13
List Price:  HK$1,092.22
You save:  HK$312.08
CHF 80.34
List Price:  CHF 112.49
You save:  CHF 32.14
NOK kr1,002.34
List Price:  NOK kr1,403.32
You save:  NOK kr400.97
DKK kr640.19
List Price:  DKK kr896.29
You save:  DKK kr256.10
NZ$170.50
List Price:  NZ$238.70
You save:  NZ$68.20
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,161.77
List Price:  ৳17,026.97
You save:  ৳4,865.19
₹8,804.49
List Price:  ₹12,326.64
You save:  ₹3,522.15
RM422.70
List Price:  RM591.80
You save:  RM169.10
₦153,629.63
List Price:  ₦215,087.63
You save:  ₦61,458
₨28,293.93
List Price:  ₨39,612.64
You save:  ₨11,318.70
฿3,234.32
List Price:  ฿4,528.18
You save:  ฿1,293.86
₺4,114.84
List Price:  ₺5,760.95
You save:  ₺1,646.10
B$547.02
List Price:  B$765.85
You save:  B$218.83
R1,762.70
List Price:  R2,467.86
You save:  R705.15
Лв167.91
List Price:  Лв235.08
You save:  Лв67.17
₩138,945.27
List Price:  ₩194,528.94
You save:  ₩55,583.66
₪336.77
List Price:  ₪471.49
You save:  ₪134.72
₱5,729.37
List Price:  ₱8,021.35
You save:  ₱2,291.98
¥14,854.21
List Price:  ¥20,796.49
You save:  ¥5,942.28
MX$1,870.35
List Price:  MX$2,618.57
You save:  MX$748.21
QR364.32
List Price:  QR510.06
You save:  QR145.74
P1,347.77
List Price:  P1,886.93
You save:  P539.16
KSh12,913.70
List Price:  KSh18,079.70
You save:  KSh5,166
E£4,858.94
List Price:  E£6,802.71
You save:  E£1,943.77
ብር14,285.86
List Price:  ብር20,000.78
You save:  ብር5,714.91
Kz91,186.39
List Price:  Kz127,664.59
You save:  Kz36,478.20
CLP$97,354.26
List Price:  CLP$136,299.86
You save:  CLP$38,945.60
CN¥713
List Price:  CN¥998.24
You save:  CN¥285.23
RD$6,298.47
List Price:  RD$8,818.11
You save:  RD$2,519.64
DA12,991.06
List Price:  DA18,188
You save:  DA5,196.94
FJ$226.12
List Price:  FJ$316.58
You save:  FJ$90.46
Q766.32
List Price:  Q1,072.87
You save:  Q306.55
GY$20,908.02
List Price:  GY$29,272.07
You save:  GY$8,364.04
ISK kr12,319.76
List Price:  ISK kr17,248.16
You save:  ISK kr4,928.40
DH904.41
List Price:  DH1,266.21
You save:  DH361.80
L1,648.78
List Price:  L2,308.36
You save:  L659.58
ден5,288.25
List Price:  ден7,403.76
You save:  ден2,115.51
MOP$803.86
List Price:  MOP$1,125.44
You save:  MOP$321.57
N$1,771.48
List Price:  N$2,480.14
You save:  N$708.66
C$3,679.53
List Price:  C$5,151.49
You save:  C$1,471.96
रु14,112.30
List Price:  रु19,757.79
You save:  रु5,645.48
S/353.41
List Price:  S/494.79
You save:  S/141.37
K419.26
List Price:  K586.98
You save:  K167.72
SAR375.19
List Price:  SAR525.29
You save:  SAR150.09
ZK2,368.97
List Price:  ZK3,316.66
You save:  ZK947.68
L435.57
List Price:  L609.82
You save:  L174.24
Kč2,097.30
List Price:  Kč2,936.30
You save:  Kč839
Ft33,774.46
List Price:  Ft47,285.59
You save:  Ft13,511.13
SEK kr943.78
List Price:  SEK kr1,321.33
You save:  SEK kr377.55
ARS$135,932.91
List Price:  ARS$190,311.51
You save:  ARS$54,378.60
Bs690.86
List Price:  Bs967.24
You save:  Bs276.37
COP$400,952.08
List Price:  COP$561,348.96
You save:  COP$160,396.87
₡50,547.65
List Price:  ₡70,768.74
You save:  ₡20,221.08
L2,635.35
List Price:  L3,689.60
You save:  L1,054.24
₲722,145.91
List Price:  ₲1,011,033.16
You save:  ₲288,887.25
$U4,001.81
List Price:  $U5,602.70
You save:  $U1,600.88
zł364.73
List Price:  zł510.64
You save:  zł145.90
Already have an account? Log In

Transcript

Let's take just a few minutes to talk about using let to declare variables. Let is a new keyword that's a part of the ES six or ECMO script six standard. It is supported by all modern browsers. So the latest versions of those browsers support lat. lat works very similar to var for declaring variables. The main difference has to do with the scope of that variable once you've declared it.

Now, scope is something we have not talked about yet. And we'll delve into that in a lot more detail when we talk about scope. But basically what scope means is what area of the program or the code is this variable accessible, okay, and so let allows us to control that a little better. Let's look at how that works. Basically it works exactly like var. The only difference is instead of using var, as the first part of the declaration we use let it creates a variable that we can then reference.

In the same way. Once again, the main difference is the scope of it and we'll revisit this again when we talk about scope.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.