Context - Discussion

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
€96.96
List Price:  €135.76
You save:  €38.79
£80.48
List Price:  £112.68
You save:  £32.19
CA$144.46
List Price:  CA$202.25
You save:  CA$57.79
A$161.30
List Price:  A$225.82
You save:  A$64.52
S$136.99
List Price:  S$191.80
You save:  S$54.80
HK$777.77
List Price:  HK$1,088.91
You save:  HK$311.14
CHF 90.85
List Price:  CHF 127.20
You save:  CHF 36.34
NOK kr1,136.41
List Price:  NOK kr1,591.02
You save:  NOK kr454.61
DKK kr723.41
List Price:  DKK kr1,012.81
You save:  DKK kr289.39
NZ$179.27
List Price:  NZ$250.99
You save:  NZ$71.71
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳12,128.31
List Price:  ৳16,980.12
You save:  ৳4,851.81
₹8,576.54
List Price:  ₹12,007.50
You save:  ₹3,430.96
RM449.95
List Price:  RM629.95
You save:  RM180
₦154,533.88
List Price:  ₦216,353.62
You save:  ₦61,819.73
₨27,801.31
List Price:  ₨38,922.95
You save:  ₨11,121.63
฿3,449.55
List Price:  ฿4,829.51
You save:  ฿1,379.96
₺3,537.66
List Price:  ₺4,952.87
You save:  ₺1,415.20
B$618.15
List Price:  B$865.44
You save:  B$247.28
R1,871.01
List Price:  R2,619.49
You save:  R748.48
Лв189.93
List Price:  Лв265.91
You save:  Лв75.98
₩146,672.33
List Price:  ₩205,347.13
You save:  ₩58,674.80
₪365.15
List Price:  ₪511.23
You save:  ₪146.07
₱5,820.16
List Price:  ₱8,148.46
You save:  ₱2,328.30
¥15,717.92
List Price:  ¥22,005.72
You save:  ¥6,287.80
MX$2,062.93
List Price:  MX$2,888.18
You save:  MX$825.25
QR363.91
List Price:  QR509.49
You save:  QR145.58
P1,387.42
List Price:  P1,942.44
You save:  P555.02
KSh12,902.87
List Price:  KSh18,064.53
You save:  KSh5,161.66
E£5,074.19
List Price:  E£7,104.07
You save:  E£2,029.88
ብር12,747.15
List Price:  ብር17,846.53
You save:  ብር5,099.37
Kz91,190.88
List Price:  Kz127,670.88
You save:  Kz36,480
CLP$100,306.99
List Price:  CLP$140,433.80
You save:  CLP$40,126.81
CN¥731.98
List Price:  CN¥1,024.81
You save:  CN¥292.82
RD$6,097.60
List Price:  RD$8,536.88
You save:  RD$2,439.28
DA13,576.62
List Price:  DA19,007.81
You save:  DA5,431.19
FJ$232.59
List Price:  FJ$325.64
You save:  FJ$93.04
Q770.19
List Price:  Q1,078.30
You save:  Q308.10
GY$20,875.31
List Price:  GY$29,226.27
You save:  GY$8,350.96
ISK kr13,930.45
List Price:  ISK kr19,503.19
You save:  ISK kr5,572.73
DH1,006.87
List Price:  DH1,409.67
You save:  DH402.79
L1,858.26
List Price:  L2,601.64
You save:  L743.38
ден5,964.46
List Price:  ден8,350.49
You save:  ден2,386.02
MOP$799.84
List Price:  MOP$1,119.81
You save:  MOP$319.96
N$1,873.51
List Price:  N$2,622.99
You save:  N$749.48
C$3,673.10
List Price:  C$5,142.49
You save:  C$1,469.38
रु13,705.64
List Price:  रु19,188.44
You save:  रु5,482.80
S/374.69
List Price:  S/524.59
You save:  S/149.89
K399.88
List Price:  K559.85
You save:  K159.96
SAR375.52
List Price:  SAR525.74
You save:  SAR150.22
ZK2,780.17
List Price:  ZK3,892.35
You save:  ZK1,112.18
L482.45
List Price:  L675.45
You save:  L193
Kč2,440.45
List Price:  Kč3,416.73
You save:  Kč976.28
Ft40,319.96
List Price:  Ft56,449.56
You save:  Ft16,129.60
SEK kr1,111.16
List Price:  SEK kr1,555.68
You save:  SEK kr444.51
ARS$103,239.67
List Price:  ARS$144,539.67
You save:  ARS$41,300
Bs689.83
List Price:  Bs965.79
You save:  Bs275.96
COP$436,758.87
List Price:  COP$611,479.89
You save:  COP$174,721.02
₡50,884.43
List Price:  ₡71,240.24
You save:  ₡20,355.80
L2,537.04
List Price:  L3,551.96
You save:  L1,014.92
₲781,454.93
List Price:  ₲1,094,068.17
You save:  ₲312,613.23
$U4,391.87
List Price:  $U6,148.80
You save:  $U1,756.92
zł414.23
List Price:  zł579.94
You save:  zł165.71
Already have an account? Log In

Transcript

Earlier in this class, we asked the very important question, what is context in JavaScript? And we found the answer was context is the object to which a method belongs. That discussion was fairly high levels. Let's dig in a little bit deeper. Here I have this object called account. And it has two properties, account number, which is a number and get account number, which is a function.

In JavaScript. When a property is a function. It's also called a method that happens to be true for a number of languages. But here the get account number property is a method because it's a function and that function returns the value of the account number property of this object. So in this case, it will return 12345. Now we could have just said in our get account number method, return account dot account number, but that's not very elegant.

So what we do as we say return this dot account number now since get account number is a method, the JavaScript This keyword inside of that method refers to the object to which that method belongs. And that method belongs to the account object. So the get account number method returns the account number property of whatever object it belongs to, which happens to be the account object. So when we say this dot account number, we're really saying account dot account number. So it's just really important to remember that when it comes to context, the JavaScript this keyword refers to the object to which a method belongs. Now let's dig in a little bit deeper and look at some actual code examples.

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.