WEEK 4: Javascript Array Methods and Iterators
(January 30 & February 1)

To Do This Week:

CodeAcademy – just the lessons, not the projects 
Learn Javascript :
8. “Iterators“,
9. “Objects

Read: Eloquent Javascript:


Class

Circles improved

REVIEW
download review-javascript.js
put this file into the same folder as your starter/ javascript file

CodeAcademy Tutorials – Complete by Monday Feb 27th ( I will check score in class)

QUIZ 1 – Monday Feb 27th,  10%)
A multiple choice and short answer quiz (identify syntax, errors and read scripts)

QUIZ 2 End of semester, late April, 10%
You will be asked to hand code a series of scripts

JavaScript Quiz Study Guide
complete JavaScript CodeAcademy

JavaScript and the DOM
traversing  // get to elements on the page
event listener // interacting with elements 
dom events //  types of interaction with elements
dom style reference // getting/changing css values of elements

Array Methods:

pop(); // remove the last element of an array:
push(); // add a new item to an array:
shift(); // remove the first item of an array:
unshift(); // add new items to the beginning of an array:
splice(); // adds/removes items to/from an array, and returns the removed item(s)
sort(), reverse() // the sort() method sorts an array alphabetically, and sets number arrays to ascending or descending
slice(); // returns the selected elements in an array, as a new array object.

Iterators:

forEach(); // calls a provided function once for each element in an array, in order
findIndex();  // returns the index of the first element in an array that pass a test (provided as a function)
filter(); // creates an array filled with all array elements that pass a test (provided as a function).
map(); // creates a new array with the results of calling a function for every array element.
some(); // checks if any of the elements in an array pass a test (provided as a function).
every(); // method checks if all elements in an array pass a test (provided as a function)
reduce(); // method reduces the array to a single value

Switch vs Conditionals 


Workshop

In-Class Exercise: What Thing Are You Quiz?  
(functions and for loop)

Vote example
Scale example
Complex example


Generative digital art or writing refers to a type of creative expression that uses a computer script or algorithm. The computer generates the artwork, poem or story based on parameters set by the artist/writer or through self-generating processes. The output can be a unique, often random and evolving, digital work.

JavaScript and Poetic Text 
Taroko Gorge
Taper: an online literary magazine for small computational pieces

Interactive text toy
template – story-generator
template – line scramble poem

E-Lit Project (10%) DUE Monday Feb 20th

Program and design your own “generative” poem or story using some of the text  manipulation techniques you have learned.