Professional Documents
Culture Documents
grittly
grittly_dev
by grittly
DATA TYPES
JS data type
object
T
F
0
1
1
1
0
0
0
1
1
a
0
b
1
c
d
e
array
f
n
u
l
l
u
n
boolean
d
e
fi
n
s
e
y
d
m
b
o
l
number
string
function
OBJECT
OBJECT ANATOMY
Internal Prototype
Reference
[[Prototype]]
Parent object
prototype property of
Parent (object)
PROTOYPE CHAIN
FUNCTION ANATOMY
"this" context
inactivated function
points to
Function.prototype
INPUT (arguments)
FUNCTION
OUTPUT
activated function
"THIS"
"this"
object to which
context
the function is
attached to
function
output value
(undefined by
default
new empty
object {}
constructor
(still just
a function)
Take value of
"this" from Object attached to
CLASS
constructor
(still just
a function)
Object attached to
the constructor under
"prototype" key
[[Prototype]] [[Prototype]]
PROTOTYPE CHAIN
Scenario 2
Scenario 1
N D!ast
U l
FO the th
e
T
NOnull is
e nt
in
lem n
D ! e
ch
ai
UN
Initial
FO D !
object being
UN
FO
{ } object attached
called upon.
to the constructor
Instance of Property being
under "prototype" Since JS keeps looking
Child class looked up
property, with its for [[Prototype]] of
constructor function
constructor
that attaches
properties to "this"
Object attached to
the constructor under
"prototype" key
variables from
Child class
[[Prototype]]
PROTOYPE CHAIN points to Parent PROTOYPE CHAIN
class' prototype
object
Parent.prototype
Object created
using Child
class