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.14
List Price:  €68.29
You save:  €34.15
£29.88
List Price:  £59.77
You save:  £29.89
CA$55.16
List Price:  CA$110.34
You save:  CA$55.17
A$60.51
List Price:  A$121.04
You save:  A$60.52
S$51.68
List Price:  S$103.37
You save:  S$51.69
HK$311.12
List Price:  HK$622.33
You save:  HK$311.20
CHF 31.79
List Price:  CHF 63.60
You save:  CHF 31.80
NOK kr407.44
List Price:  NOK kr814.99
You save:  NOK kr407.54
DKK kr255.09
List Price:  DKK kr510.25
You save:  DKK kr255.15
NZ$69.56
List Price:  NZ$139.14
You save:  NZ$69.57
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,888.86
List Price:  ৳9,778.94
You save:  ৳4,890.08
₹3,571.62
List Price:  ₹7,144.14
You save:  ₹3,572.51
RM163.03
List Price:  RM326.11
You save:  RM163.08
₦58,280.62
List Price:  ₦116,575.82
You save:  ₦58,295.20
₨11,201.27
List Price:  ₨22,405.35
You save:  ₨11,204.07
฿1,258.44
List Price:  ฿2,517.20
You save:  ฿1,258.76
₺1,711.97
List Price:  ₺3,424.37
You save:  ₺1,712.39
B$221.23
List Price:  B$442.52
You save:  B$221.28
R671.27
List Price:  R1,342.72
You save:  R671.44
Лв66.77
List Price:  Лв133.57
You save:  Лв66.79
₩59,127.99
List Price:  ₩118,270.78
You save:  ₩59,142.78
₪128.32
List Price:  ₪256.68
You save:  ₪128.35
₱2,341.85
List Price:  ₱4,684.29
You save:  ₱2,342.43
¥6,286.52
List Price:  ¥12,574.62
You save:  ¥6,288.10
MX$721.14
List Price:  MX$1,442.47
You save:  MX$721.32
QR145.78
List Price:  QR291.60
You save:  QR145.81
P528.28
List Price:  P1,056.70
You save:  P528.41
KSh5,154.71
List Price:  KSh10,310.71
You save:  KSh5,156
E£1,903.33
List Price:  E£3,807.14
You save:  E£1,903.81
ብር6,217.16
List Price:  ብር12,435.88
You save:  ብር6,218.72
Kz36,476.63
List Price:  Kz72,962.39
You save:  Kz36,485.76
CLP$36,354.54
List Price:  CLP$72,718.18
You save:  CLP$36,363.63
CN¥281.56
List Price:  CN¥563.19
You save:  CN¥281.63
RD$2,511.99
List Price:  RD$5,024.61
You save:  RD$2,512.62
DA5,186.05
List Price:  DA10,373.41
You save:  DA5,187.35
FJ$91.32
List Price:  FJ$182.67
You save:  FJ$91.34
Q306.17
List Price:  Q612.42
You save:  Q306.25
GY$8,363.65
List Price:  GY$16,729.40
You save:  GY$8,365.74
ISK kr5,039.93
List Price:  ISK kr10,081.13
You save:  ISK kr5,041.20
DH366.40
List Price:  DH732.89
You save:  DH366.49
L669.34
List Price:  L1,338.86
You save:  L669.51
ден2,101.31
List Price:  ден4,203.15
You save:  ден2,101.83
MOP$320.40
List Price:  MOP$640.89
You save:  MOP$320.48
N$670.27
List Price:  N$1,340.72
You save:  N$670.44
C$1,471.03
List Price:  C$2,942.44
You save:  C$1,471.40
रु5,770.91
List Price:  रु11,543.26
You save:  रु5,772.35
S/134.59
List Price:  S/269.23
You save:  S/134.63
K172.30
List Price:  K344.66
You save:  K172.35
SAR149.99
List Price:  SAR300.02
You save:  SAR150.03
ZK909.46
List Price:  ZK1,819.15
You save:  ZK909.69
L173.76
List Price:  L347.58
You save:  L173.81
Kč831.92
List Price:  Kč1,664.05
You save:  Kč832.13
Ft13,220.09
List Price:  Ft26,443.48
You save:  Ft13,223.39
SEK kr372.29
List Price:  SEK kr744.67
You save:  SEK kr372.38
ARS$58,014.50
List Price:  ARS$116,043.51
You save:  ARS$58,029.01
Bs276.23
List Price:  Bs552.53
You save:  Bs276.29
COP$154,310.19
List Price:  COP$308,658.96
You save:  COP$154,348.77
₡19,918.60
List Price:  ₡39,842.18
You save:  ₡19,923.58
L1,052.95
List Price:  L2,106.16
You save:  L1,053.21
₲267,137.51
List Price:  ₲534,341.83
You save:  ₲267,204.32
$U1,570.02
List Price:  $U3,140.45
You save:  $U1,570.42
zł143.73
List Price:  zł287.49
You save:  zł143.76
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.