Variables

2 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
€85.01
List Price:  €119.02
You save:  €34
£74.08
List Price:  £103.71
You save:  £29.63
CA$138.06
List Price:  CA$193.28
You save:  CA$55.22
A$151.41
List Price:  A$211.98
You save:  A$60.57
S$128.39
List Price:  S$179.76
You save:  S$51.36
HK$777.55
List Price:  HK$1,088.60
You save:  HK$311.05
CHF 79.50
List Price:  CHF 111.31
You save:  CHF 31.80
NOK kr990.78
List Price:  NOK kr1,387.13
You save:  NOK kr396.35
DKK kr634.55
List Price:  DKK kr888.40
You save:  DKK kr253.84
NZ$170.19
List Price:  NZ$238.28
You save:  NZ$68.08
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,174.73
List Price:  ৳17,045.11
You save:  ৳4,870.37
₹8,810.73
List Price:  ₹12,335.38
You save:  ₹3,524.64
RM420.65
List Price:  RM588.93
You save:  RM168.28
₦149,972
List Price:  ₦209,966.80
You save:  ₦59,994.80
₨28,291.87
List Price:  ₨39,609.76
You save:  ₨11,317.88
฿3,183.98
List Price:  ฿4,457.70
You save:  ฿1,273.72
₺4,138.49
List Price:  ₺5,794.06
You save:  ₺1,655.56
B$531.23
List Price:  B$743.75
You save:  B$212.51
R1,735.27
List Price:  R2,429.45
You save:  R694.17
Лв166.19
List Price:  Лв232.68
You save:  Лв66.48
₩139,621.31
List Price:  ₩195,475.43
You save:  ₩55,854.11
₪333.48
List Price:  ₪466.89
You save:  ₪133.40
₱5,712.52
List Price:  ₱7,997.76
You save:  ₱2,285.23
¥14,792.65
List Price:  ¥20,710.30
You save:  ¥5,917.65
MX$1,835.78
List Price:  MX$2,570.17
You save:  MX$734.38
QR366.82
List Price:  QR513.56
You save:  QR146.74
P1,430.96
List Price:  P2,003.40
You save:  P572.44
KSh12,952.70
List Price:  KSh18,134.30
You save:  KSh5,181.60
E£4,816.78
List Price:  E£6,743.69
You save:  E£1,926.90
ብር14,387.11
List Price:  ብር20,142.53
You save:  ብር5,755.42
Kz91,186.39
List Price:  Kz127,664.59
You save:  Kz36,478.20
CLP$95,570.44
List Price:  CLP$133,802.44
You save:  CLP$38,232
CN¥711.31
List Price:  CN¥995.87
You save:  CN¥284.55
RD$6,221.03
List Price:  RD$8,709.70
You save:  RD$2,488.66
DA12,950.21
List Price:  DA18,130.81
You save:  DA5,180.60
FJ$224.85
List Price:  FJ$314.80
You save:  FJ$89.95
Q766.29
List Price:  Q1,072.85
You save:  Q306.55
GY$20,926.15
List Price:  GY$29,297.44
You save:  GY$8,371.29
ISK kr12,156.78
List Price:  ISK kr17,019.98
You save:  ISK kr4,863.20
DH903.23
List Price:  DH1,264.56
You save:  DH361.32
L1,663.31
List Price:  L2,328.70
You save:  L665.39
ден5,229.59
List Price:  ден7,321.64
You save:  ден2,092.04
MOP$801.41
List Price:  MOP$1,122.01
You save:  MOP$320.59
N$1,743.36
List Price:  N$2,440.78
You save:  N$697.41
C$3,677.54
List Price:  C$5,148.70
You save:  C$1,471.16
रु14,094.94
List Price:  रु19,733.48
You save:  रु5,638.54
S/349.66
List Price:  S/489.54
You save:  S/139.87
K426.80
List Price:  K597.54
You save:  K170.74
SAR375
List Price:  SAR525.01
You save:  SAR150.01
ZK2,370.59
List Price:  ZK3,318.92
You save:  ZK948.33
L431.47
List Price:  L604.08
You save:  L172.60
Kč2,063.99
List Price:  Kč2,889.68
You save:  Kč825.68
Ft33,216.64
List Price:  Ft46,504.62
You save:  Ft13,287.98
SEK kr938.94
List Price:  SEK kr1,314.55
You save:  SEK kr375.61
ARS$147,416.76
List Price:  ARS$206,389.36
You save:  ARS$58,972.60
Bs691.25
List Price:  Bs967.78
You save:  Bs276.52
COP$390,251.14
List Price:  COP$546,367.20
You save:  COP$156,116.06
₡50,404.89
List Price:  ₡70,568.86
You save:  ₡20,163.97
L2,636.34
List Price:  L3,690.98
You save:  L1,054.64
₲716,255.91
List Price:  ₲1,002,786.92
You save:  ₲286,531.01
$U3,994.64
List Price:  $U5,592.65
You save:  $U1,598.01
zł362.46
List Price:  zł507.46
You save:  zł145
Already have an account? Log In

Transcript

Hello, in this JavaScript video, I am going to show you variables in relation to classes. So let's have a look at how we can create variables in a class in JavaScript. So to create any, you go to constructor, just put this.in the name of the variable. So I'm going to create one for x and y. So this will equal x. And we'll create one for y.

So this dot y equals one, okay, and to access these values, we simply console log, console log, and also no auditing or supreme brackets, and then we'll put the value of it. So value is called OBJ. Or whatever the your call object is called dot x or the variable name plus Karma. Again, this is the formatting part of it, where you the hell, totally up to you, but the accent is caught, you know OBJ dot exe and called da da. Say that right? We Yeah, forget to put a comma at the end.

And no come on closing bracket on me. There we go Okay, we got those on you duplicate this one I'm going to duplicate this one here. So it's gonna be separate core object and I want to say is position is 90, and zero and what we'll do is coordinate so you can see that each one has its own different properties and variables to those 5678 90 and zero. And as you can see, we've got two different objects And we have variables. So that's how you create a variable inside of it in the constructor, just do like this dot, you know, x, for example, don't have to assign a value straight away. It's always good to have default value.

They could even be passed in or, you know, maybe by default x and y, zero, and zero, who let's say it's the name of the call. You might have a default name or owner or you know, something along those lines. I think of variables in class. If you have any questions, feel free to shoot me a message and I'm forcing you next video.

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.