This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Prototype/Pattern


This is a thread of interest started in Zoho by Andre Dublin.

I'll be talking about prototype here, and trying to remake these patterns using ecmascript 5

----

Basic Object

http://jsfiddle.net/dublinan/dLhsV/

Basic Object with ecmascript 5

http://jsfiddle.net/dublinan/XhqHL/

----

Strange when I open this with IE, I get undefined instead of Andre, Andre. But I get the correct function on firefox.

----

Only IE9 and other modern browsers have support for ecmascript 5.  Thats why you get undefined for the returned value.

ecmascript 5 support link
http://kangax.github.com/es5-compat-table/

----

There are two links towards the bottom of the Week 1 material that lead to tables showing what is compatible where.

----

Classical inheritance using a constructor function

http://jsfiddle.net/dublinan/mQbn8/

I'll have a ECMAScript 5 version up shortly

----

Task Discussion