Mediascripting on the Web (CSC 195 2014F) : Outlines

Outline 06: Javascript (1)

Held: Thursday, 27 February 2014

Back to Outline 05 - HTML and Cascading Style Sheets. On to Outline 07 - Class Canclled for SIGCSE.


We consider the basics of Javascript.

Related Pages



About Javascript

Simple Javascript

Loading external libraries

Including code directly

Functions declared with

function NAME(PARAMS)

Variables declared with

var NAME;

Instructions look a lot like C, except that you can also tell things to do operations with THING.OPERATION.

var str = "Hello";
str.indexOf("ll") -> 2

You can call functions from the console. And that's a good place to start, particularly since smart consoles have autocomplete.

You can call functions in response to events. That's the most typical way of making things interactive.

Here are a few basic commands to get you started.

var obj = document.getElementById(ID)
obj.innerHTML = "TEXT"; = "red"; = "black";

Grr ... sam can't get setTimeout to work.


Here's a series of operations a student tells me they found in Goedel, Escher, Bach

I believe Hofsteder (sp?) asks whether you can go from MI to MU, but that's irrelevant to our case.

Make a simple Web UI that lets someone explore this design space. Presumably, you'll have a button for each of the options.


Make a game. It can be animated, text, numeric, whatever. Upload the game in its own folder.

Copyright (c) 2014 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.