Javascript Arrays - Functions - OO Patterns - Classes - Patterns




CS174

Chris Pollett

Apr 21, 2021

Outline

Arrays

More Arrays

Functions

Function Example

function swap(i, j, a)
{
	var tmp=a[i]; /* explicitly defined variables 
                         have scope within the function
                         if I had declared the variable 
                         implicitly it would have global scope */
	a[i] = a[j]; a[j] = tmp;
}

Constructors

Methods

In-Class Exercise

More on the Prototype Property