Advanced Javascript and DOM Manipulation Flashcards
1
Q
Adding Event Listeners to a Button
A
.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
2
Q
Higher Order Functions and Passing Functions as…
A
Arguments
3
Q
How to play sounds on a website
A
Create a new Audio(< File Path >); Call the .play(); of the audio object
4
Q
Javascript Objects
A
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
5
Q
Switch Statements
A
switch ( expression ) case < >: Run the code for the case break default: “Else statement”
6
Q
Keyboard Event Listener
A
document.addEventListener(‘keypress’, handler)
7
Q
Understanding Callbacks and How to Respond to Event Listener
// Callback function
A
Function that gets passed in as an input