Notes
In-class Notes
Lecture #6
---------
PLAN
* Assignment 2
- aliases
- headers
- other clarifications?
* Objects
- associative hashes with inheritance
- prototypes using Object.create
- "global" object
- "Object" object
- Object.prototype
- hasOwnProperty and Object.hasOwnProperty
* Function calling and "this"
- functions in regular scope
- methods
- constructors with new
- call/apply
- functions in global scope
* form demo!
------------------
If a function starts with a capital letter, it is an object
constructor that you call with new.
- why? because it keeps JavaScript programmers sort of sane
if (x.a) { blah} instead do
if (x.hasOwnProperty(a) && x.a) better, but
if (hasOwnProperty.call(x,a) && x.a) is even better
Why not tinywebserver?
* templates: otherwise, have to manually generate web pages using
variable data
* routing: otherwise, you'll be using regexp's to match each
incoming URL and then call the right function