Constants

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
$39.99
List Price:  $79.99
You save:  $40
€34.65
List Price:  €69.31
You save:  €34.66
£29.93
List Price:  £59.87
You save:  £29.94
CA$54.75
List Price:  CA$109.52
You save:  CA$54.76
A$56.22
List Price:  A$112.45
You save:  A$56.23
S$51.04
List Price:  S$102.10
You save:  S$51.05
HK$313.46
List Price:  HK$627.01
You save:  HK$313.54
CHF 31.43
List Price:  CHF 62.87
You save:  CHF 31.44
NOK kr383.58
List Price:  NOK kr767.26
You save:  NOK kr383.67
DKK kr258.96
List Price:  DKK kr518
You save:  DKK kr259.03
NZ$68.20
List Price:  NZ$136.42
You save:  NZ$68.22
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,892.76
List Price:  ৳9,786.74
You save:  ৳4,893.98
₹3,705.01
List Price:  ₹7,410.95
You save:  ₹3,705.93
RM156.62
List Price:  RM313.28
You save:  RM156.66
₦54,186.45
List Price:  ₦108,386.45
You save:  ₦54,200
₨11,133.25
List Price:  ₨22,269.29
You save:  ₨11,136.04
฿1,294.57
List Price:  ฿2,589.47
You save:  ฿1,294.90
₺1,768.14
List Price:  ₺3,536.73
You save:  ₺1,768.58
B$207.55
List Price:  B$415.15
You save:  B$207.60
R664.94
List Price:  R1,330.05
You save:  R665.11
Лв67.78
List Price:  Лв135.59
You save:  Лв67.80
₩59,521.64
List Price:  ₩119,058.17
You save:  ₩59,536.53
₪123.41
List Price:  ₪246.85
You save:  ₪123.44
₱2,384.74
List Price:  ₱4,770.08
You save:  ₱2,385.34
¥6,354.97
List Price:  ¥12,711.54
You save:  ¥6,356.56
MX$704.12
List Price:  MX$1,408.42
You save:  MX$704.29
QR145.38
List Price:  QR290.81
You save:  QR145.42
P541.91
List Price:  P1,083.96
You save:  P542.04
KSh5,182.70
List Price:  KSh10,366.70
You save:  KSh5,184
E£2,091.37
List Price:  E£4,183.26
You save:  E£2,091.89
ብር6,225.26
List Price:  ብር12,452.09
You save:  ብር6,226.82
Kz36,476.11
List Price:  Kz72,961.35
You save:  Kz36,485.24
CLP$36,267.33
List Price:  CLP$72,543.73
You save:  CLP$36,276.40
CN¥274.84
List Price:  CN¥549.76
You save:  CN¥274.91
RD$2,433.92
List Price:  RD$4,868.46
You save:  RD$2,434.53
DA5,278.97
List Price:  DA10,559.27
You save:  DA5,280.29
FJ$88.26
List Price:  FJ$176.54
You save:  FJ$88.28
Q305.45
List Price:  Q610.98
You save:  Q305.52
GY$8,342.67
List Price:  GY$16,687.43
You save:  GY$8,344.76
ISK kr4,978.35
List Price:  ISK kr9,957.95
You save:  ISK kr4,979.60
DH373.93
List Price:  DH747.95
You save:  DH374.02
L697.24
List Price:  L1,394.65
You save:  L697.41
ден2,136.04
List Price:  ден4,272.62
You save:  ден2,136.58
MOP$321.86
List Price:  MOP$643.80
You save:  MOP$321.94
N$667.08
List Price:  N$1,334.34
You save:  N$667.25
C$1,467.49
List Price:  C$2,935.35
You save:  C$1,467.86
रु5,891.94
List Price:  रु11,785.36
You save:  रु5,893.42
S/136.29
List Price:  S/272.62
You save:  S/136.32
K172.04
List Price:  K344.13
You save:  K172.08
SAR150.15
List Price:  SAR300.35
You save:  SAR150.19
ZK777.78
List Price:  ZK1,555.76
You save:  ZK777.98
L176.51
List Price:  L353.08
You save:  L176.56
Kč846.74
List Price:  Kč1,693.69
You save:  Kč846.95
Ft13,468.91
List Price:  Ft26,941.20
You save:  Ft13,472.28
SEK kr371.68
List Price:  SEK kr743.45
You save:  SEK kr371.77
ARS$55,833.28
List Price:  ARS$111,680.53
You save:  ARS$55,847.24
Bs275.54
List Price:  Bs551.16
You save:  Bs275.61
COP$147,549.56
List Price:  COP$295,136.01
You save:  COP$147,586.45
₡18,691.05
List Price:  ₡37,386.77
You save:  ₡18,695.72
L1,055.41
List Price:  L2,111.09
You save:  L1,055.68
₲258,501.60
List Price:  ₲517,067.84
You save:  ₲258,566.24
$U1,619.60
List Price:  $U3,239.61
You save:  $U1,620
zł147.69
List Price:  zł295.41
You save:  zł147.72
Already have an account? Log In

Transcript

So now let's talk about constants. in JavaScript a constant is some kind of a box so to speak, that are that you are going to store something inside it, and you are most likely not going to change it. So for example, your nationality is probably not going to be changed. Your height when you are an adult is is not going to be changed. So you can store these variables or these values inside the constant not available because you you don't want to change these throughout your program. So to create a constant, as we learned with variables you just create, you just type the keyword in instead of var as we learn for variables, you type const const, and then the name of that constant could be your nationality, nationality, For example, UK, and then semicolon, so this is a constant, something that is not going to be changed could be something else like const, your height, height, or my height equals to 100, ad, and then semicolon.

So these things are not going to be changed. So if you, if you store these in variables, it's okay. But if you want to follow best practices in JavaScript, just store these values in constants, so that you follow the best practices in JavaScript, because these are not going to be changed.

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.