Professional Documents
Culture Documents
studio
prototypes
Daniel Jackson
Object
1.blue: 0
2.green: 255
3.red: 255
4.__proto__: Object
...
code] }
...
> yellow.hasOwnProperty("red")
true
> yellow.hasOwnProperty("reddish")
false
_proto
_slots
JS Object
_value
Slot
String
_property
!
"hasOwnProperty"
property (String)
(Object)
(Slot)
value
...
(Function)
property
"bits"
(String)
value
24
(Object)
property
"red"
(String)
value
0
(Object)
_proto
(Object)
> green.red
> green.bits
24
slots
slots
(Slot)
_proto
green
(Object)
slots
(Slot)
_proto
?
_constructor
JS Object
?
prototype
Function
> green.red
> green.bits
24
Color.prototype.toCSS = function () {
document.body.style.backgroundColor = green.toCSS();
}
undefined
Color
Object
Color
"RGB"
> red.bits
undefined
> green.bits
24
> red.space
undefined
> green.space
"RGB"
extending built-ins
result.push(f(e));
});
return result;
[1, 4, 9]
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.