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.30
List Price:  €119.42
You save:  €34.12
£74.90
List Price:  £104.87
You save:  £29.96
CA$137.80
List Price:  CA$192.93
You save:  CA$55.12
A$151.38
List Price:  A$211.95
You save:  A$60.56
S$129.13
List Price:  S$180.79
You save:  S$51.66
HK$778.04
List Price:  HK$1,089.29
You save:  HK$311.25
CHF 79.64
List Price:  CHF 111.50
You save:  CHF 31.86
NOK kr1,019.49
List Price:  NOK kr1,427.33
You save:  NOK kr407.84
DKK kr637.36
List Price:  DKK kr892.32
You save:  DKK kr254.96
NZ$173.48
List Price:  NZ$242.88
You save:  NZ$69.40
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,210.89
List Price:  ৳17,095.74
You save:  ৳4,884.84
₹9,025.29
List Price:  ₹12,635.77
You save:  ₹3,610.47
RM408.55
List Price:  RM571.99
You save:  RM163.44
₦145,380.46
List Price:  ₦203,538.46
You save:  ₦58,158
₨27,945.82
List Price:  ₨39,125.27
You save:  ₨11,179.44
฿3,146.73
List Price:  ฿4,405.55
You save:  ฿1,258.82
₺4,273.01
List Price:  ₺5,982.39
You save:  ₺1,709.37
B$553.54
List Price:  B$774.98
You save:  B$221.44
R1,677.41
List Price:  R2,348.44
You save:  R671.03
Лв166.62
List Price:  Лв233.28
You save:  Лв66.65
₩147,650.32
List Price:  ₩206,716.36
You save:  ₩59,066.03
₪322.40
List Price:  ₪451.37
You save:  ₪128.97
₱5,865.31
List Price:  ₱8,211.67
You save:  ₱2,346.36
¥15,592.08
List Price:  ¥21,829.54
You save:  ¥6,237.45
MX$1,800.44
List Price:  MX$2,520.69
You save:  MX$720.25
QR363.60
List Price:  QR509.05
You save:  QR145.45
P1,319.75
List Price:  P1,847.71
You save:  P527.95
KSh12,893.71
List Price:  KSh18,051.71
You save:  KSh5,158
E£4,757.54
List Price:  E£6,660.75
You save:  E£1,903.20
ብር15,505.04
List Price:  ብር21,707.68
You save:  ብር6,202.63
Kz91,205.27
List Price:  Kz127,691.03
You save:  Kz36,485.76
CLP$91,733.94
List Price:  CLP$128,431.19
You save:  CLP$36,697.24
CN¥704.05
List Price:  CN¥985.71
You save:  CN¥281.65
RD$6,277.50
List Price:  RD$8,788.76
You save:  RD$2,511.25
DA12,944.99
List Price:  DA18,123.50
You save:  DA5,178.51
FJ$228.40
List Price:  FJ$319.77
You save:  FJ$91.37
Q765.32
List Price:  Q1,071.48
You save:  Q306.16
GY$20,906.17
List Price:  GY$29,269.47
You save:  GY$8,363.30
ISK kr12,624.73
List Price:  ISK kr17,675.13
You save:  ISK kr5,050.40
DH913.94
List Price:  DH1,279.55
You save:  DH365.61
L1,686.32
List Price:  L2,360.92
You save:  L674.59
ден5,247.62
List Price:  ден7,346.88
You save:  ден2,099.25
MOP$800.66
List Price:  MOP$1,120.95
You save:  MOP$320.29
N$1,670.36
List Price:  N$2,338.58
You save:  N$668.21
C$3,670.25
List Price:  C$5,138.50
You save:  C$1,468.24
रु14,432.11
List Price:  रु20,205.53
You save:  रु5,773.42
S/335.99
List Price:  S/470.40
You save:  S/134.41
K424.09
List Price:  K593.74
You save:  K169.65
SAR375.04
List Price:  SAR525.07
You save:  SAR150.03
ZK2,286.39
List Price:  ZK3,201.04
You save:  ZK914.64
L434.33
List Price:  L608.08
You save:  L173.75
Kč2,081.93
List Price:  Kč2,914.79
You save:  Kč832.85
Ft33,264.92
List Price:  Ft46,572.22
You save:  Ft13,307.30
SEK kr930.79
List Price:  SEK kr1,303.14
You save:  SEK kr372.35
ARS$145,060.50
List Price:  ARS$203,090.50
You save:  ARS$58,030
Bs689.19
List Price:  Bs964.89
You save:  Bs275.70
COP$383,834.59
List Price:  COP$537,383.79
You save:  COP$153,549.19
₡49,786.33
List Price:  ₡69,702.86
You save:  ₡19,916.52
L2,627.70
List Price:  L3,678.89
You save:  L1,051.18
₲671,189.15
List Price:  ₲939,691.66
You save:  ₲268,502.51
$U3,917.97
List Price:  $U5,485.31
You save:  $U1,567.34
zł358.87
List Price:  zł502.44
You save:  zł143.56
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.