JS Flashcards

1
Q

Where does Javascript go?

A
Like CSS, there are three options:
1. Inline – mixed in with the HTML tags
2. Internal – contained within  tags
3. External – contained in a .js file that is linked to from the HTML 
page
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the different events that can trigger JS functions?

A
onclick – user clicked the element
onchange – the element changed
onmouseover – mouse hovers over the element
onmouseout – mouse left the element
onkeydown – user pressed a key
onload – page finished loading
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

is this an example of Inline JS?

<h1>
Main Title</h1>

A

Yes

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

What are Event Handlers?

A

The JavaScript code that runs when the event happens is called an
event handler.

They also be used with browser events, e.g.

when the user refreshes the page
when the user exits a page
when the user clicks back

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

What are the four ways of Generating Javascript output?

A
  1. Modifying the innerHTML propery of document objects
  2. Using the document.write() method to append HTML to the
    current document
  3. Using alert() to pop up a message box
  4. Using console.log() to write to the browser’s JavaScript console
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
What would be the value of carName in this statement?
var person = "John Doe", carName, price = 200;
A

Undefined

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