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.21
List Price:  €68.43
You save:  €34.22
£29.66
List Price:  £59.33
You save:  £29.67
CA$55.16
List Price:  CA$110.35
You save:  CA$55.18
A$61.10
List Price:  A$122.22
You save:  A$61.12
S$51.46
List Price:  S$102.93
You save:  S$51.47
HK$312.03
List Price:  HK$624.14
You save:  HK$312.11
CHF 32.11
List Price:  CHF 64.24
You save:  CHF 32.12
NOK kr401.67
List Price:  NOK kr803.45
You save:  NOK kr401.77
DKK kr255.41
List Price:  DKK kr510.89
You save:  DKK kr255.47
NZ$68.04
List Price:  NZ$136.11
You save:  NZ$68.06
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,868.14
List Price:  ৳9,737.51
You save:  ৳4,869.36
₹3,529.50
List Price:  ₹7,059.88
You save:  ₹3,530.38
RM168.90
List Price:  RM337.86
You save:  RM168.95
₦61,122.31
List Price:  ₦122,259.91
You save:  ₦61,137.60
₨11,352.43
List Price:  ₨22,707.71
You save:  ₨11,355.27
฿1,287.39
List Price:  ฿2,575.11
You save:  ฿1,287.72
₺1,649.77
List Price:  ₺3,299.95
You save:  ₺1,650.18
B$217.85
List Price:  B$435.76
You save:  B$217.91
R707.27
List Price:  R1,414.71
You save:  R707.44
Лв66.98
List Price:  Лв133.98
You save:  Лв67
₩55,593.84
List Price:  ₩111,201.58
You save:  ₩55,607.74
₪133.56
List Price:  ₪267.16
You save:  ₪133.59
₱2,275.61
List Price:  ₱4,551.79
You save:  ₱2,276.18
¥5,925.49
List Price:  ¥11,852.46
You save:  ¥5,926.97
MX$746.88
List Price:  MX$1,493.95
You save:  MX$747.07
QR145.59
List Price:  QR291.22
You save:  QR145.63
P575.58
List Price:  P1,151.30
You save:  P575.72
KSh5,166.70
List Price:  KSh10,334.70
You save:  KSh5,168
E£1,941.52
List Price:  E£3,883.53
You save:  E£1,942
ብር5,721.79
List Price:  ብር11,445.02
You save:  ብር5,723.22
Kz36,469.08
List Price:  Kz72,947.28
You save:  Kz36,478.20
CLP$38,879.87
List Price:  CLP$77,769.47
You save:  CLP$38,889.60
CN¥285.16
List Price:  CN¥570.39
You save:  CN¥285.23
RD$2,535.76
List Price:  RD$5,072.16
You save:  RD$2,536.40
DA5,193.23
List Price:  DA10,387.77
You save:  DA5,194.53
FJ$90.23
List Price:  FJ$180.48
You save:  FJ$90.25
Q306.89
List Price:  Q613.87
You save:  Q306.97
GY$8,368.31
List Price:  GY$16,738.73
You save:  GY$8,370.41
ISK kr4,899.57
List Price:  ISK kr9,800.37
You save:  ISK kr4,900.80
DH362.96
List Price:  DH726.02
You save:  DH363.06
L670.43
List Price:  L1,341.04
You save:  L670.60
ден2,112.24
List Price:  ден4,225.01
You save:  ден2,112.77
MOP$321.36
List Price:  MOP$642.81
You save:  MOP$321.44
N$709.42
List Price:  N$1,419.02
You save:  N$709.60
C$1,471.90
List Price:  C$2,944.18
You save:  C$1,472.27
रु5,637.55
List Price:  रु11,276.52
You save:  रु5,638.96
S/140.86
List Price:  S/281.76
You save:  S/140.90
K169.50
List Price:  K339.04
You save:  K169.54
SAR150.04
List Price:  SAR300.13
You save:  SAR150.08
ZK951.86
List Price:  ZK1,903.96
You save:  ZK952.10
L173.78
List Price:  L347.61
You save:  L173.82
Kč835.99
List Price:  Kč1,672.19
You save:  Kč836.19
Ft13,444.53
List Price:  Ft26,892.42
You save:  Ft13,447.89
SEK kr376.32
List Price:  SEK kr752.74
You save:  SEK kr376.41
ARS$54,486.61
List Price:  ARS$108,986.84
You save:  ARS$54,500.23
Bs276.50
List Price:  Bs553.08
You save:  Bs276.57
COP$159,741.91
List Price:  COP$319,523.76
You save:  COP$159,781.85
₡20,221.55
List Price:  ₡40,448.16
You save:  ₡20,226.60
L1,047.97
List Price:  L2,096.21
You save:  L1,048.24
₲288,326.82
List Price:  ₲576,725.74
You save:  ₲288,398.92
$U1,602.41
List Price:  $U3,205.22
You save:  $U1,602.81
zł145.54
List Price:  zł291.13
You save:  zł145.58
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.