WebFund 2016W Lecture 6: Difference between revisions
Added more in-class notes. |
No edit summary |
||
| Line 1: | Line 1: | ||
==Video== | |||
The video from the lecture given on January 26, 2016 [http://homeostasis.scs.carleton.ca/~soma/webfund-2016w/lectures/comp2406-2016w-lec06-26Jan2016.mp4 is now available]. | |||
==Notes== | ==Notes== | ||
Revision as of 21:33, 26 January 2016
Video
The video from the lecture given on January 26, 2016 is now available.
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