CS98SI: Introduction to JavaScript

Announcements

Homework 2

Homework 2 is here!

AJAX demo

In the AJAX lecture, we build a small web application, which you can download here.

HTML Template

You can get a blank HTML template here.

Piazza

This quarter we will be using Piazza for class discussion. Please sign up here.

Course information

Course information can be found here.

Previous labs

In-class labs can be found here. (The labs are for practice only and will not count towards your final grade.)

Homework

Syllabus

Overview of JavaScript (Week 1 Lecture 1)

What is JavaScript? Brief history. Common use-cases. Runtime environments. ECMAScript standards. Overview of language features. Running JavaScript in the browser and at the command line. Debugging JavaScript in the browser. The console and REPL. (Flanagan Chapters 1–2)

Basic syntax (Week 1 Lecture 2)

Values and literals. Primitive types. Numbers. Integer and floating point as a single type. Special floating point numbers. Rounding errors. The Math library. Strings. Immutability of strings. + and [] operators. toString. Common string utilities. Booleans. Ternary operator. Truth-y and False-y values. null and undefined. Regular expressions. Dynamic typing. Weak typing. The typeof operator. The === and !== operators. Control statements. (Flanagan Chapters 3–5)

Arrays and Objects (Week 2 Lecture 1)

Arrays. Array insertion and deletion. Array length. Sparse arrays. Multidimensional arrays. Almost everything is an object. Objects as unordered maps. Object creation, modification and lookup syntax. Nested objects. Object methods. The delete keyword. The for... in statement, and the hasOwnProperty method. The global window object. Object references. Aliasing. Pass-by-reference-copy semantics. (Flanagan Chapters 6–7)

Functions (Week 2 Lecture 2)

Function declaration and invocation syntax. Anonymous functions. Functions as data. The arguments object. Variadic functions. Optional parameters. Named parameters. Function overloading. Duck typing. (Flanagan Chapter 8)

HTML and CSS and The Document Object Model (Week 3 Lecture 1)

Tags. Document structure. Elements. Text, forms, images, blocks and frames. Selectors. Cascading and inheritence. Text and color tyles. The box model. Layout. The DOM as an document API. Browser information. The setTimer and setTimeout. Element lookup. Tree traversal. Attribute getting and setting. Creating and deleting nodes. Events. (Flanagan Chapters 15 and 16)

jQuery (Week 3 Lecture 2)

Overview of jQuery. Cross-browser compatibility. The $ function object. Element selectors. Tree traversal. Node creation, insertion, modification and deletion. Getting and setting attributes, styles and class. Wrapping and unwrapping DOM raw objects. The chaining pattern. (Flanagan Chapter 19)

More jQuery (Week 4 Lecture 1)

Event handling. bind and unbind. Keyboard and mouse events. Event delegation and bubbling. Animation. (Flanagan Chapters 17, 19)

AJAX with jQuery (Week 4 Lecture 2)

AJAX. Asynchronous communication. Callback functions. The get and post formats. Same-origin policy. Cross-origin requests with JSONP. AJAX polling. (Flanagan Chapter 19)

Context (Week 5 Lecture 1)

Object method invocation as method passing. The this variable as an implicit parameter variable. Problems with methods in event handlers and callbacks. Usage of call and apply. Binding context. The new keyword. (Course Reader)

Closures (Week 5 Lecture 2)

Lexical scope. Inner functions. Closure scope. Examining closure scope in the debugger. Functors. Simulation of private object properties. Simulation of namespaces. (Crockford Chapter 4)

Higher-order Functions (Week 6 Lecture 1)

Functional programming. Side effects. Referential transparancy. Iteration over collections without loops. Implementation of map, reduce, find, filter. (Course Reader)

More Higher-Order Functions (Week 6 Lecture 2)

Implementation of curry, memoize, and debounce. (Course Reader)

Security (Week 7 Lecture 1)

Same-origin policy. Cross-site scripting attacks (reflected and persisted). Cookie theft and forgery. Whitelisting and blacklisting.

Node.js (Week 7 Lecture 2)

Server-side scripting. Threaded vs event-based server models. Working with callbacks. The Express web framework.

Backbone.js (Week 9 Lecture 1)

Guest lecture by Min Ming Lo, Pixelapse.

TBD (Week 8 Lecture 2)

Guest lecture from Leith Abdulla, Coursera. The anatomy of a javascript module: the design, layout and components of a typical javascript library used to help a front-end team scale their work.

HTML 5 APIs (Week 8 Lecture 1)

HTML 5 APIs.

d3.js (Week 9 Lecture 2)

Data visualization. Drawing graphics using SVG. Selections with select and selectAll. Adding and deleting elements with enter and exit. Binding data with data. Animation with transition. (Course reader)

The Future of JavaScript (Week 10 Lecture 1)

Current trends in JavaScript. JIT engines. New EMCAScript features. The HTML5 roadmap. Alternative MVC frameworks: AngularJS, Ember.js, Knockout. CoffeeScript. Trends towards fat clients and API-based services. (Course reader)