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
€86.30
List Price:  €120.82
You save:  €34.52
£74.61
List Price:  £104.46
You save:  £29.85
CA$137.64
List Price:  CA$192.71
You save:  CA$55.06
A$154.65
List Price:  A$216.52
You save:  A$61.86
S$128.63
List Price:  S$180.09
You save:  S$51.45
HK$784.78
List Price:  HK$1,098.73
You save:  HK$313.94
CHF 80.41
List Price:  CHF 112.58
You save:  CHF 32.17
NOK kr1,032.35
List Price:  NOK kr1,445.34
You save:  NOK kr412.98
DKK kr644.05
List Price:  DKK kr901.70
You save:  DKK kr257.64
NZ$169.01
List Price:  NZ$236.62
You save:  NZ$67.61
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳12,121.40
List Price:  ৳16,970.45
You save:  ৳4,849.04
₹8,610.19
List Price:  ₹12,054.61
You save:  ₹3,444.42
RM424.85
List Price:  RM594.81
You save:  RM169.96
₦152,771.72
List Price:  ₦213,886.52
You save:  ₦61,114.80
₨28,497.15
List Price:  ₨39,897.15
You save:  ₨11,400
฿3,251.47
List Price:  ฿4,552.19
You save:  ฿1,300.72
₺4,028.08
List Price:  ₺5,639.48
You save:  ₺1,611.39
B$556.82
List Price:  B$779.57
You save:  B$222.75
R1,789.93
List Price:  R2,505.97
You save:  R716.04
Лв168.67
List Price:  Лв236.14
You save:  Лв67.47
₩139,216.21
List Price:  ₩194,908.26
You save:  ₩55,692.05
₪335.61
List Price:  ₪469.87
You save:  ₪134.26
₱5,726.02
List Price:  ₱8,016.66
You save:  ₱2,290.63
¥14,862.43
List Price:  ¥20,807.99
You save:  ¥5,945.56
MX$1,881.25
List Price:  MX$2,633.82
You save:  MX$752.57
QR363.36
List Price:  QR508.72
You save:  QR145.36
P1,349.68
List Price:  P1,889.60
You save:  P539.92
KSh12,923.70
List Price:  KSh18,093.70
You save:  KSh5,170
E£4,941.52
List Price:  E£6,918.33
You save:  E£1,976.80
ብር13,825.55
List Price:  ብር19,356.32
You save:  ብር5,530.77
Kz91,186.38
List Price:  Kz127,664.58
You save:  Kz36,478.20
CLP$97,077.66
List Price:  CLP$135,912.62
You save:  CLP$38,834.95
CN¥717.92
List Price:  CN¥1,005.12
You save:  CN¥287.20
RD$6,026.40
List Price:  RD$8,437.20
You save:  RD$2,410.80
DA13,016.54
List Price:  DA18,223.68
You save:  DA5,207.13
FJ$226.22
List Price:  FJ$316.72
You save:  FJ$90.50
Q766.74
List Price:  Q1,073.46
You save:  Q306.72
GY$20,906.23
List Price:  GY$29,269.56
You save:  GY$8,363.33
ISK kr12,238.77
List Price:  ISK kr17,134.77
You save:  ISK kr4,896
DH904.11
List Price:  DH1,265.79
You save:  DH361.68
L1,699.79
List Price:  L2,379.78
You save:  L679.98
ден5,295.15
List Price:  ден7,413.43
You save:  ден2,118.27
MOP$807.98
List Price:  MOP$1,131.21
You save:  MOP$323.22
N$1,793.78
List Price:  N$2,511.36
You save:  N$717.58
C$3,677.38
List Price:  C$5,148.48
You save:  C$1,471.10
रु13,736.94
List Price:  रु19,232.27
You save:  रु5,495.32
S/355.84
List Price:  S/498.19
You save:  S/142.35
K412.28
List Price:  K577.21
You save:  K164.93
SAR375.06
List Price:  SAR525.10
You save:  SAR150.04
ZK2,278.40
List Price:  ZK3,189.86
You save:  ZK911.45
L437.81
List Price:  L612.96
You save:  L175.14
Kč2,126.07
List Price:  Kč2,976.59
You save:  Kč850.51
Ft34,443.95
List Price:  Ft48,222.91
You save:  Ft13,778.96
SEK kr975.87
List Price:  SEK kr1,366.26
You save:  SEK kr390.38
ARS$126,136.94
List Price:  ARS$176,596.76
You save:  ARS$50,459.82
Bs690.53
List Price:  Bs966.78
You save:  Bs276.24
COP$403,727.98
List Price:  COP$565,235.32
You save:  COP$161,507.34
₡50,423.54
List Price:  ₡70,594.98
You save:  ₡20,171.43
L2,614.17
List Price:  L3,659.95
You save:  L1,045.77
₲773,801.72
List Price:  ₲1,083,353.36
You save:  ₲309,551.64
$U4,044.70
List Price:  $U5,662.74
You save:  $U1,618.04
zł367.13
List Price:  zł514.01
You save:  zł146.87
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.