Objects are just hash tables Prototypical inheritance model Functions are regular objects (with a twist) Arrays are regular objects (with a twist) Thursday, July 12, 12
Freshman goto: party Worker salary : 3800 Freshman.grade === 90 // from Student Student.age === 12 // from Person Worker.age === 12 // from Person Worker.salary === 3800 // from Worker Thursday, July 12, 12
an object literal. Car should provide members: max_speed and drive() Write maker functions for 3 car models using the object() function. Implement a function on a car model which uses data from Car Thursday, July 12, 12
Contact objects. Each Contact should have a name field and a phone field. Test by creating 5 contacts in the Phonebook and print them to the console. Thursday, July 12, 12
new object is created before entering the function That object is passed as the this argument That object becomes the default return value of the function Function’s prototype is assigned to the object Thursday, July 12, 12
name: 'Mike', job: 'Musician' }; Foo.prototype = p; var p1 = new Foo(); var p2 = new Foo(); // Prints out mike console.log( p1.name ); Thursday, July 12, 12
Britain</td> </tr> <tr> <td>Yen</td> <td>Japan</td> </tr> <tr> <td>Euro</td> <td>EMU</td> </tr> </table> Dollar USA Pound Great Britain Yen Japan Thursday, July 12, 12
into four sections. Each click on a section should display a sentence inside the clicked section Write a web app to convert time units. User should enter time in seconds, minutes or hours, and convert to all the others Thursday, July 12, 12
produce each product Implement a product method that takes a name of a product, and runs its correct producer function CarFactory.produce = function(model) { var ctor = CarFactory[model]; return ctor(); } Thursday, July 12, 12
only one visible component at a time; on Desktop, can have more than one. Each component has its own JS file Different components can communicate using a global object in a private namespace A single controller object moves components in/ out of view Thursday, July 12, 12