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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Higher Order Functions and Passing Functions as…

A

Arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to play sounds on a website

A
Create a new Audio(< File Path >);
Call the .play(); of the audio object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Switch Statements

A
switch ( expression )
case < >:
Run the code for the case
break
default:
“Else statement”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Keyboard Event Listener

A

document.addEventListener(‘keypress’, handler)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Understanding Callbacks and How to Respond to Event Listener

// Callback function

A

Function that gets passed in as an input

How well did you know this?
1
Not at all
2
3
4
5
Perfectly