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
€33.97
List Price:  €67.96
You save:  €33.98
£29.37
List Price:  £58.75
You save:  £29.37
CA$54.56
List Price:  CA$109.15
You save:  CA$54.58
A$55.28
List Price:  A$110.57
You save:  A$55.29
S$50.69
List Price:  S$101.40
You save:  S$50.70
HK$313.08
List Price:  HK$626.24
You save:  HK$313.16
CHF 31.10
List Price:  CHF 62.22
You save:  CHF 31.11
NOK kr368.92
List Price:  NOK kr737.94
You save:  NOK kr369.02
DKK kr253.91
List Price:  DKK kr507.88
You save:  DKK kr253.97
NZ$67.06
List Price:  NZ$134.14
You save:  NZ$67.08
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,922.69
List Price:  ৳9,846.62
You save:  ৳4,923.92
₹3,778.02
List Price:  ₹7,556.99
You save:  ₹3,778.96
RM156.80
List Price:  RM313.64
You save:  RM156.84
₦54,435.58
List Price:  ₦108,884.78
You save:  ₦54,449.20
₨11,178.57
List Price:  ₨22,359.94
You save:  ₨11,181.36
฿1,287.67
List Price:  ฿2,575.67
You save:  ฿1,288
₺1,814.13
List Price:  ₺3,628.73
You save:  ₺1,814.59
B$196.97
List Price:  B$394
You save:  B$197.02
R656.84
List Price:  R1,313.84
You save:  R657
Лв66.45
List Price:  Лв132.92
You save:  Лв66.47
₩58,699.68
List Price:  ₩117,414.04
You save:  ₩58,714.36
₪116.22
List Price:  ₪232.47
You save:  ₪116.25
₱2,421.03
List Price:  ₱4,842.67
You save:  ₱2,421.64
¥6,265.72
List Price:  ¥12,533.01
You save:  ¥6,267.29
MX$689.43
List Price:  MX$1,379.04
You save:  MX$689.61
QR146.24
List Price:  QR292.52
You save:  QR146.27
P537.17
List Price:  P1,074.48
You save:  P537.30
KSh5,164.70
List Price:  KSh10,330.70
You save:  KSh5,166
E£2,108.30
List Price:  E£4,217.12
You save:  E£2,108.82
ብር6,264.17
List Price:  ብር12,529.90
You save:  ብር6,265.73
Kz36,515.50
List Price:  Kz73,040.14
You save:  Kz36,524.64
CLP$35,629.89
List Price:  CLP$71,268.69
You save:  CLP$35,638.80
CN¥271.99
List Price:  CN¥544.05
You save:  CN¥272.06
RD$2,385.87
List Price:  RD$4,772.34
You save:  RD$2,386.47
DA5,287.59
List Price:  DA10,576.50
You save:  DA5,288.91
FJ$87.33
List Price:  FJ$174.69
You save:  FJ$87.35
Q305.44
List Price:  Q610.96
You save:  Q305.52
GY$8,380.90
List Price:  GY$16,763.91
You save:  GY$8,383
ISK kr4,886.37
List Price:  ISK kr9,773.97
You save:  ISK kr4,887.60
DH367.71
List Price:  DH735.52
You save:  DH367.80
L683.82
List Price:  L1,367.82
You save:  L683.99
ден2,094.14
List Price:  ден4,188.80
You save:  ден2,094.66
MOP$323.10
List Price:  MOP$646.28
You save:  MOP$323.18
N$654.58
List Price:  N$1,309.33
You save:  N$654.75
C$1,476.31
List Price:  C$2,952.99
You save:  C$1,476.68
रु6,050.19
List Price:  रु12,101.89
You save:  रु6,051.70
S/138.96
List Price:  S/277.96
You save:  S/139
K174.34
List Price:  K348.72
You save:  K174.38
SAR151.16
List Price:  SAR302.37
You save:  SAR151.20
ZK764.27
List Price:  ZK1,528.74
You save:  ZK764.46
L177.95
List Price:  L355.94
You save:  L177.99
Kč826.01
List Price:  Kč1,652.23
You save:  Kč826.22
Ft12,077.50
List Price:  Ft24,158.02
You save:  Ft12,080.52
SEK kr368.47
List Price:  SEK kr737.04
You save:  SEK kr368.57
ARS$55,808.18
List Price:  ARS$111,630.31
You save:  ARS$55,822.13
Bs277.22
List Price:  Bs554.52
You save:  Bs277.29
COP$148,339.34
List Price:  COP$296,715.77
You save:  COP$148,376.43
₡18,403.77
List Price:  ₡36,812.15
You save:  ₡18,408.37
L1,066.56
List Price:  L2,133.39
You save:  L1,066.83
₲245,553
List Price:  ₲491,167.41
You save:  ₲245,614.41
$U1,604.25
List Price:  $U3,208.91
You save:  $U1,604.65
zł143.70
List Price:  zł287.45
You save:  zł143.74
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.