Object Properties

3 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.34
List Price:  €68.70
You save:  €34.35
£29.75
List Price:  £59.51
You save:  £29.76
CA$55.26
List Price:  CA$110.54
You save:  CA$55.28
A$61.34
List Price:  A$122.71
You save:  A$61.36
S$51.56
List Price:  S$103.13
You save:  S$51.57
HK$311.87
List Price:  HK$623.83
You save:  HK$311.95
CHF 32.19
List Price:  CHF 64.39
You save:  CHF 32.20
NOK kr403.80
List Price:  NOK kr807.72
You save:  NOK kr403.91
DKK kr256.36
List Price:  DKK kr512.80
You save:  DKK kr256.43
NZ$68.25
List Price:  NZ$136.51
You save:  NZ$68.26
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,863.12
List Price:  ৳9,727.46
You save:  ৳4,864.33
₹3,524.96
List Price:  ₹7,050.81
You save:  ₹3,525.84
RM169.05
List Price:  RM338.15
You save:  RM169.10
₦61,064.73
List Price:  ₦122,144.73
You save:  ₦61,080
₨11,267.18
List Price:  ₨22,537.18
You save:  ₨11,270
฿1,293.08
List Price:  ฿2,586.50
You save:  ฿1,293.41
₺1,646.44
List Price:  ₺3,293.30
You save:  ₺1,646.85
B$218.38
List Price:  B$436.81
You save:  B$218.43
R711.68
List Price:  R1,423.54
You save:  R711.85
Лв67.10
List Price:  Лв134.21
You save:  Лв67.11
₩55,741.82
List Price:  ₩111,497.59
You save:  ₩55,755.76
₪134.54
List Price:  ₪269.12
You save:  ₪134.57
₱2,284.41
List Price:  ₱4,569.39
You save:  ₱2,284.98
¥5,931.38
List Price:  ¥11,864.24
You save:  ¥5,932.86
MX$750.38
List Price:  MX$1,500.95
You save:  MX$750.57
QR145.58
List Price:  QR291.21
You save:  QR145.62
P536.90
List Price:  P1,073.94
You save:  P537.04
KSh5,166.70
List Price:  KSh10,334.70
You save:  KSh5,168
E£1,941.39
List Price:  E£3,883.26
You save:  E£1,941.87
ብር5,716.16
List Price:  ብር11,433.76
You save:  ብር5,717.59
Kz36,469.08
List Price:  Kz72,947.28
You save:  Kz36,478.20
CLP$38,726.71
List Price:  CLP$77,463.11
You save:  CLP$38,736.40
CN¥285.16
List Price:  CN¥570.39
You save:  CN¥285.23
RD$2,518.39
List Price:  RD$5,037.41
You save:  RD$2,519.02
DA5,195.45
List Price:  DA10,392.21
You save:  DA5,196.75
FJ$90.43
List Price:  FJ$180.89
You save:  FJ$90.46
Q306.32
List Price:  Q612.73
You save:  Q306.40
GY$8,355.08
List Price:  GY$16,712.25
You save:  GY$8,357.17
ISK kr4,932.76
List Price:  ISK kr9,866.76
You save:  ISK kr4,934
DH363.26
List Price:  DH726.63
You save:  DH363.36
L668.13
List Price:  L1,336.43
You save:  L668.29
ден2,110.62
List Price:  ден4,221.77
You save:  ден2,111.14
MOP$320.92
List Price:  MOP$641.92
You save:  MOP$321
N$704.48
List Price:  N$1,409.15
You save:  N$704.66
C$1,469.67
List Price:  C$2,939.71
You save:  C$1,470.03
रु5,632.07
List Price:  रु11,265.56
You save:  रु5,633.48
S/141.26
List Price:  S/282.56
You save:  S/141.30
K166.62
List Price:  K333.28
You save:  K166.66
SAR150.04
List Price:  SAR300.13
You save:  SAR150.08
ZK949.74
List Price:  ZK1,899.73
You save:  ZK949.98
L174.39
List Price:  L348.82
You save:  L174.43
Kč839.73
List Price:  Kč1,679.67
You save:  Kč839.94
Ft13,526.45
List Price:  Ft27,056.29
You save:  Ft13,529.83
SEK kr378.31
List Price:  SEK kr756.72
You save:  SEK kr378.41
ARS$54,428.90
List Price:  ARS$108,871.42
You save:  ARS$54,442.52
Bs275.96
List Price:  Bs551.99
You save:  Bs276.03
COP$160,141.69
List Price:  COP$320,323.44
You save:  COP$160,181.74
₡20,189.65
List Price:  ₡40,384.34
You save:  ₡20,194.69
L1,046.93
List Price:  L2,094.13
You save:  L1,047.20
₲288,443.91
List Price:  ₲576,959.95
You save:  ₲288,516.04
$U1,602.41
List Price:  $U3,205.22
You save:  $U1,602.81
zł146.11
List Price:  zł292.25
You save:  zł146.14
Already have an account? Log In

Transcript

To important properties of objects, or they are dynamic, and we can have any type of value. So for example, if we have an object called person again, person, and then equals two curly braces, and it has two properties, name, john and age, age 23. And we want to add another property. It's so simple. You don't have to come here inside and add the property. You just can use the object itself, and then use the dot notation and then add the property that you want.

Suppose that you want to add the height for that person, you would just type dot and then height Then equals to the value that you want to assign for this property. So I want this value to be 180. And if I now use the console, console dot log, and then I print out this object, I am going to get this object with three properties, because this property was dynamically added after the creation of the object. And of course, you can add as many properties as you want later. If you want to add more, because sometimes you just want to add more properties because your program requires you to add more properties as your program grows bigger and bigger. Another important property is that objects can have different types of values.

So far, we only use strings as well as integers with our But you can add also functions inside objects, let me show you, you just see your ad comma. And instead of using just the string or integer, you just type the name of the function, for example, get Country, Country. And then you just add a colon. And instead of just adding a string, or an integer, you type up your function and then just add your parentheses, and then curly braces and inside those curly braces, you add the code for this function for this function that you want this this function to do. So I want this function to just print out the country or the nationality of that person. For example, us, right?

And if now I see and now if I call this function, instead of printing out the complete object here I am going to use the object itself and then I am going to call the get country function, parentheses and then semicolon. If now I save and run, I am going to get us. So this is the power of using objects. objects have many, many properties. And objects can also have different types of values and the different types of data type and they are dynamic.

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.