Programming Languages: Principles and Paradigms

Intro and JavaScript

Lecture slides and code

You can get the slides here. The slides refer to some JavaScript files, provided below. You can also play with this code in your browser here and here.

If you have not worked with JavaScript before, take some time to familiarize yourself with the basics of the language, as most of the labs in this class will be in JavaScript.

We recommend the Mozilla Developer Network’s JavaScript Guide, but there are many other tutorials on the Internet.

Dave Herman’s Effective JavaScript is very good reference that covers a lot of the JavaScript intricacies. You will not this for the class, but if you end up writing JavaScript code in the outside world, this book is must-read.

Additional resources/reading for the curious

Source files we used in class

Code illustrating how to implement block scoping with functions:

Code illustrating the use of callback to perform synchronous and asynchronous filesystem reads:

Code illustrating the use of high order functions and closures:

Code illustrating the use of functions to implement modules:

Code illustrating the use of arrow function syntax for function expressions:

Code illustrating simple methods and constructors for JavaScript: