Dojo Dijit and HTML5 in Real world applications/University/2. Advanced Java script I

This is the second lesson on the HTML5, CSS3 and Advanced JavaScript course. PowerPoint presentation used at the lecture

The first part of the lecture is based on the objects and arrays examples.

The second part is based on the First class functions demo. A simplified version of dojo/dijit layout is found in the Basic_structure.php.

Objects and arrays
JavaScript is a class-less programming language. However, yet Object Oriented Programming (OOP) is widely used in JavaScript. The following provide an insight to the way to make OOP in JavaScript.

Objects vs. Arrays
JavaScript is object oriented. All variables are objects. Even Arrays are objects. Objects may be defined in three different ways: It is only possible to make a "associative" array using the last example. Some times it difficult the see a difference between an array and an object. JavaScript arrays are meant to be numeric. if you need to hold key/value pairs then it is better practice to use Objects instead. See: How Weird are JavaScript Arrays?

Prototype and differential inheritance
Differential inheritance works as in other object oriented programming languages. Prototype is special: Changing the prototype change all inherited objects: Existing objects and new! The working example may be found here

dijit.layout
This section is based on the First class functions demo. If you would like to start easy a simplified version is also available. We will focus on the following elements:
 * The Soft loader
 * dijit.layout.BorderContainer
 * dijit.layout.AccordionContainer
 * dijit.layout.TabContainer
 * All containers use the dijit.layout.ContentPane

First class functions
Finally we will discuss the first class function example below:

Home work

 * Get the examples to work on your local server.
 * Add more calculators to the "First class functions" example.