Javascript Functions - OO Patterns - Classes - Patterns




CS174

Chris Pollett

Nov 2, 2020

Outline

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

Variable Hoisting

The Module Pattern

More Faking Visibility

OO in Ecmascript 2015

Modules in Ecmascript 2015 and Beyond

Pattern Matching

Pattern Special Characters

Slash Patterns

Yet more special characters

Pattern Modifiers

More Pattern Methods