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.26
List Price:  €119.37
You save:  €34.10
£74.75
List Price:  £104.65
You save:  £29.90
CA$137.57
List Price:  CA$192.60
You save:  CA$55.03
A$149.94
List Price:  A$209.93
You save:  A$59.98
S$129.15
List Price:  S$180.82
You save:  S$51.66
HK$778.49
List Price:  HK$1,089.91
You save:  HK$311.42
CHF 79.53
List Price:  CHF 111.35
You save:  CHF 31.81
NOK kr1,010.83
List Price:  NOK kr1,415.20
You save:  NOK kr404.37
DKK kr636.88
List Price:  DKK kr891.67
You save:  DKK kr254.78
NZ$172.05
List Price:  NZ$240.87
You save:  NZ$68.82
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,196.53
List Price:  ৳17,075.63
You save:  ৳4,879.10
₹9,046.19
List Price:  ₹12,665.03
You save:  ₹3,618.84
RM410
List Price:  RM574.02
You save:  RM164.02
₦144,988.49
List Price:  ₦202,989.69
You save:  ₦58,001.20
₨28,070.07
List Price:  ₨39,299.22
You save:  ₨11,229.15
฿3,154.68
List Price:  ฿4,416.68
You save:  ฿1,262
₺4,269.03
List Price:  ₺5,976.82
You save:  ₺1,707.78
B$540.64
List Price:  B$756.92
You save:  B$216.28
R1,686.31
List Price:  R2,360.91
You save:  R674.59
Лв166.76
List Price:  Лв233.47
You save:  Лв66.71
₩147,691.32
List Price:  ₩206,773.76
You save:  ₩59,082.43
₪320.32
List Price:  ₪448.46
You save:  ₪128.14
₱5,904.40
List Price:  ₱8,266.40
You save:  ₱2,362
¥15,590.21
List Price:  ¥21,826.92
You save:  ¥6,236.70
MX$1,803.96
List Price:  MX$2,525.62
You save:  MX$721.65
QR363.74
List Price:  QR509.26
You save:  QR145.51
P1,323.96
List Price:  P1,853.60
You save:  P529.63
KSh12,870.71
List Price:  KSh18,019.51
You save:  KSh5,148.80
E£4,753.26
List Price:  E£6,654.76
You save:  E£1,901.49
ብር15,541.53
List Price:  ብር21,758.76
You save:  ብር6,217.23
Kz91,205.27
List Price:  Kz127,691.03
You save:  Kz36,485.76
CLP$91,415.85
List Price:  CLP$127,985.85
You save:  CLP$36,570
CN¥705.43
List Price:  CN¥987.64
You save:  CN¥282.20
RD$6,391.40
List Price:  RD$8,948.22
You save:  RD$2,556.81
DA12,968.19
List Price:  DA18,155.99
You save:  DA5,187.79
FJ$227.15
List Price:  FJ$318.02
You save:  FJ$90.87
Q764.39
List Price:  Q1,070.17
You save:  Q305.78
GY$20,877.42
List Price:  GY$29,229.22
You save:  GY$8,351.80
ISK kr12,635.73
List Price:  ISK kr17,690.53
You save:  ISK kr5,054.80
DH918.06
List Price:  DH1,285.32
You save:  DH367.26
L1,690.45
List Price:  L2,366.70
You save:  L676.25
ден5,247.73
List Price:  ден7,347.03
You save:  ден2,099.30
MOP$799.94
List Price:  MOP$1,119.96
You save:  MOP$320.01
N$1,690.23
List Price:  N$2,366.39
You save:  N$676.16
C$3,672.42
List Price:  C$5,141.53
You save:  C$1,469.11
रु14,413.93
List Price:  रु20,180.08
You save:  रु5,766.14
S/336.38
List Price:  S/470.94
You save:  S/134.56
K423.47
List Price:  K592.88
You save:  K169.40
SAR375.19
List Price:  SAR525.28
You save:  SAR150.09
ZK2,311.36
List Price:  ZK3,235.99
You save:  ZK924.63
L433.96
List Price:  L607.57
You save:  L173.60
Kč2,066.18
List Price:  Kč2,892.73
You save:  Kč826.55
Ft32,745.77
List Price:  Ft45,845.39
You save:  Ft13,099.61
SEK kr928.55
List Price:  SEK kr1,300.01
You save:  SEK kr371.46
ARS$143,636.25
List Price:  ARS$201,096.50
You save:  ARS$57,460.24
Bs689.66
List Price:  Bs965.55
You save:  Bs275.89
COP$383,944.98
List Price:  COP$537,538.34
You save:  COP$153,593.35
₡48,949.59
List Price:  ₡68,531.39
You save:  ₡19,581.79
L2,627.62
List Price:  L3,678.78
You save:  L1,051.15
₲682,078.43
List Price:  ₲954,937.09
You save:  ₲272,858.66
$U3,924.12
List Price:  $U5,493.92
You save:  $U1,569.80
zł360.22
List Price:  zł504.33
You save:  zł144.10
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.