Adding Event Listeners to a Button
.addEventListener( , ); consists of a variety of different types to cause to execute the event listener e.g. “click” usually a javascript function Can also be an anonymous function
Higher Order Functions and Passing Functions as…
Arguments
How to play sounds on a website
Create a new Audio(< File Path >); Call the .play(); of the audio object
Javascript Objects
Javascript objects have one or more fields : data
Example:
var anand = { name : “Anand”, dob : “12/20/1993”}
Constructor
function (< Arguments > ) { }
Use the ‘new’ keyword to create an object
Switch Statements
switch ( expression ) case < >: Run the code for the case break default: “Else statement”
Keyboard Event Listener
document.addEventListener(‘keypress’, handler)
Understanding Callbacks and How to Respond to Event Listener
// Callback function
Function that gets passed in as an input