Javascript - 101

Javascript

Javascript

Javascript - Javascript - 101

Introduction


Across all of our web project the single common technology is currently Javascript. Once a misunderstood language with few decent frameworks it’s evolved into a powerful front end technology.

From wikipedia:

“JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles.

JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript, implemented as part of a Web browser in order to provide enhanced user interfaces and dynamic websites. This enables programmatic access to computational objects within a host environment.

JavaScript’s use in applications outside Web pages — for example in PDF documents, site-specific browsers, and desktop widgets — is also significant. Newer and faster JavaScript VMs and frameworks built upon them (notably Node.js) have also increased the popularity of JavaScript for server-side web applications.

JavaScript uses syntax influenced by that of C. JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics. The key design principles within JavaScript are taken from the Self and Scheme programming languages.”

Watch the introductory JS lecture by completing the following video.

Objects in JavaScript


Read Ch. 6th, “The Definitive Guide”

JavaScript’s fundamental datatype is the object. An object is a composite value: it aggregates multiple values (primitive values or other objects) and allows you to store and retrieve those values by name. An object is an unordered collection of properties, each of which has a name and a value.

Read Chapter 6 on “JavaScript, The Definitive Guide”. Named “Objects”.

####### Understand JS Object Model (Prototype)

Read this page on Javascript’s object model and make sure you understand the distinction between class-based and prototype-based languages

Functions in JavaScript


Read Ch. 8th, “The Definitive Guide”

In JavaScript, functions are objects, and they can be manipulated by programs. Java- Script can assign functions to variables and pass them to other functions, for example. Since functions are objects, you can set properties on them, and even invoke methods on them.

Read Ch. 8th, “JavaScript: The Definitive Guide”. Named: “Functions”.

Classes and Modules in JavaScript


Read Ch. 9th, “The Definitive Guide”

In JavaScript, classes are based on JavaScript’s prototype-based inheritance mechanism. If two objects inherit properties from the same prototype object, then we say that they are instances of the same class.

Read Chapter 9th on “JavaScript: The Definitive Guide”. Named “Classes and Modules”

Read JS Design Patterns

Also read Learning JavaScript Desing Patterns

Inheritance


Read Ch. 5th, “JavaScript: The Good Parts”

JavaScript, being a loosely typed language, never casts. The lineage of an object is irrelevant. What matters about an object is what it can do, not what it is descended from.

Read Chapter 5th on “JavaScript: The Good Parts”. Named “Inheritance”

Practice


Complete JS Koans

Complete the javascript koans here.

Finishing Up


Optional Reading