Everything is An Object

4 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.30
List Price:  €68.62
You save:  €34.31
£29.82
List Price:  £59.66
You save:  £29.83
CA$55.17
List Price:  CA$110.36
You save:  CA$55.19
A$61.22
List Price:  A$122.47
You save:  A$61.24
S$51.52
List Price:  S$103.05
You save:  S$51.53
HK$312
List Price:  HK$624.09
You save:  HK$312.08
CHF 32.13
List Price:  CHF 64.27
You save:  CHF 32.14
NOK kr400.87
List Price:  NOK kr801.85
You save:  NOK kr400.97
DKK kr256.03
List Price:  DKK kr512.14
You save:  DKK kr256.10
NZ$68.19
List Price:  NZ$136.39
You save:  NZ$68.20
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,863.98
List Price:  ৳9,729.17
You save:  ৳4,865.19
₹3,521.26
List Price:  ₹7,043.42
You save:  ₹3,522.15
RM169.05
List Price:  RM338.15
You save:  RM169.10
₦61,442.63
List Price:  ₦122,900.63
You save:  ₦61,458
₨11,315.87
List Price:  ₨22,634.58
You save:  ₨11,318.70
฿1,293.53
List Price:  ฿2,587.39
You save:  ฿1,293.86
₺1,645.69
List Price:  ₺3,291.79
You save:  ₺1,646.10
B$218.77
List Price:  B$437.60
You save:  B$218.83
R704.97
List Price:  R1,410.13
You save:  R705.15
Лв67.15
List Price:  Лв134.32
You save:  Лв67.17
₩55,569.77
List Price:  ₩111,153.44
You save:  ₩55,583.66
₪134.68
List Price:  ₪269.41
You save:  ₪134.72
₱2,291.40
List Price:  ₱4,583.38
You save:  ₱2,291.98
¥5,940.79
List Price:  ¥11,883.07
You save:  ¥5,942.28
MX$748.03
List Price:  MX$1,496.24
You save:  MX$748.21
QR145.70
List Price:  QR291.45
You save:  QR145.74
P539.02
List Price:  P1,078.19
You save:  P539.16
KSh5,164.70
List Price:  KSh10,330.70
You save:  KSh5,166
E£1,943.28
List Price:  E£3,887.05
You save:  E£1,943.77
ብር5,713.49
List Price:  ብር11,428.40
You save:  ብር5,714.91
Kz36,469.08
List Price:  Kz72,947.28
You save:  Kz36,478.20
CLP$38,935.86
List Price:  CLP$77,881.46
You save:  CLP$38,945.60
CN¥285.16
List Price:  CN¥570.39
You save:  CN¥285.23
RD$2,519.01
List Price:  RD$5,038.65
You save:  RD$2,519.64
DA5,195.64
List Price:  DA10,392.59
You save:  DA5,196.94
FJ$90.43
List Price:  FJ$180.89
You save:  FJ$90.46
Q306.48
List Price:  Q613.04
You save:  Q306.55
GY$8,361.95
List Price:  GY$16,726
You save:  GY$8,364.04
ISK kr4,927.16
List Price:  ISK kr9,855.56
You save:  ISK kr4,928.40
DH361.71
List Price:  DH723.51
You save:  DH361.80
L659.41
List Price:  L1,318.99
You save:  L659.58
ден2,114.98
List Price:  ден4,230.49
You save:  ден2,115.51
MOP$321.49
List Price:  MOP$643.07
You save:  MOP$321.57
N$708.48
List Price:  N$1,417.15
You save:  N$708.66
C$1,471.59
List Price:  C$2,943.55
You save:  C$1,471.96
रु5,644.07
List Price:  रु11,289.56
You save:  रु5,645.48
S/141.34
List Price:  S/282.72
You save:  S/141.37
K167.68
List Price:  K335.40
You save:  K167.72
SAR150.05
List Price:  SAR300.15
You save:  SAR150.09
ZK947.44
List Price:  ZK1,895.13
You save:  ZK947.68
L174.20
List Price:  L348.45
You save:  L174.24
Kč838.79
List Price:  Kč1,677.79
You save:  Kč839
Ft13,507.75
List Price:  Ft27,018.89
You save:  Ft13,511.13
SEK kr377.45
List Price:  SEK kr755
You save:  SEK kr377.55
ARS$54,365
List Price:  ARS$108,743.61
You save:  ARS$54,378.60
Bs276.30
List Price:  Bs552.67
You save:  Bs276.37
COP$160,356.77
List Price:  COP$320,753.65
You save:  COP$160,396.87
₡20,216.02
List Price:  ₡40,437.11
You save:  ₡20,221.08
L1,053.98
List Price:  L2,108.23
You save:  L1,054.24
₲288,815.03
List Price:  ₲577,702.28
You save:  ₲288,887.25
$U1,600.48
List Price:  $U3,201.37
You save:  $U1,600.88
zł145.87
List Price:  zł291.78
You save:  zł145.90
Already have an account? Log In

Transcript

Now that you understand objects much better, I have a shocking truth for you. Everything in JavaScript is an object. And what they mean is that literally everything in JavaScript is an object. I'm going to prove it to you so that you understand it even much better. Strings are objects, integers, or numbers are objects, even functions are objects. And I'm going to show you now, for example, suppose that we have a variable called texts.

And it's equal to just the simple texts. For example, this is my text. And if I want to print this on the screen, I would just use console dot log, and I can just pass texts, right and if I see one run, I get the My text, right? And you think now that this is just a simple variable, and that is not true. The truth is that text, this string is an object. Because if you create, if you create a VAR text one, for example, equals to new, and then string, and then you add here, you add the text that you want to print.

Let's copy and paste this inside. And then you pass text one instead of text. If I save and run, I am going to get this is my text. And it's through. It's a string. And as you can see now, strings are objects.

But why would we use this version and not this the other version with the new string that makes it clear that it's an object because the first version which is This one is much easier. Why would we use some something a little bit difficult van just using this. Always go for the easier method, and also integers or numbers or objects. And I'm going to show you that for a H equals 223. Right? This is a simple variable.

If I print it, I'm going to get 23. And we know that but this is actually an object. If I create another variable called age one equals to new and then number and then I pass 23. And then I change this from h1 to from h to h one. And if I say one run, I am going to get 23 and the type is number. So this is a fact this is a fact in JavaScript.

Is that everything in JavaScript is an object. And I'm going to show you also a very interesting thing, which is that you can get the type of a variable using type of function, just type type off. And then you just pass the object or the type or value that we want to get its type. So for example, age one, if I save and run, I am going to get object because it's an object. And for example, text one, I am going to get also that it's an object. And if I use text only text and Save and Run, I am going to get that this is a string.

Now it's more specific, because text because a string is an object, but here it says string. It did not say object because it's now more specific, but it's actually an object. So here, if I Use age only age, I'm gonna get number not an object, but it's actually an object, but it's more specific. So to make things clear, an object is kind of the king. So an object is just kind of the king or the Father, and other values like strings, integers, or numbers, Booleans functions. All of these kind of sons have that King.

So they have the same behavior, so they behave the same. That's why they are objects as well by inheritance.

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.