Intro Flashcards

1
Q

HTML creates the skeleton of a webpage, and JavaScript introduces ____

A

interactivity

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

The SCRIPT element has an opening and closing tag. You can embed JavaScript code inbetween __

A

the opening and closing SCRIPT tags.

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

You link to external JavaScript files with the ___

A

src attribute in the opening SCRIPT tag.

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

By default, scripts are loaded and executed as soon as the HTML parser encounters them in the HTML file, the HTML parser waits to load the entire script before ___

A

proceeding to parse the rest of the page elements.

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

The defer attribute ensures that __

A

the entire HTML file has been parsed before the script is executed.

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

The async attribute will allow the HTML parser to __

A

continue parsing as the script is being downloaded, but will execute immediately after it has been downloaded.

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

document.getElementbyId(‘sign’).hidden = true;

A

Hide an element b/c it doesn’t need to be loaded initially (not the same as setting CSS visibility property to hidden)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
let paragraph = document.querySelector('p');
document.body.removeChild(paragraph);
A

Remove 1st par in doc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
const parent = document.querySelector("#more-destinations");
const child = document.querySelector("#oaxaca");
parent.removeChild(child);
A

Select the element with the ID oaxaca and save it to a variable.
Select its parent, assigned an ID of more-destinations.
Remove the element using the .removeChild() method and passing in the variable containing the oaxaca element.

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

let element = document.querySelector(“button”);

function turnButtonRed (){
	element.style.backgroundColor = "red";
  element.style.color = "white";
  element.innerHTML = "Red Button"; 
}

element.onclick = turnButtonRed;

A

Add interactivity to the button. Set the button background to red. Set the button font color to white. Connect the button element to the style function for a click event. Clicking the button will change the style.

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

Define parent node.

A

In the DOM hierarchy, parent and children relationships are defined in relation to the position of the root node.

A parent node is the closest connected node to another node in the direction towards the root.

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

Define child node

A

In the DOM hierarchy, parent and children relationships are defined in relation to the position of the root node.

A child node is the closest connected node to another node in the direction away from the root.

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

What’s the DOM property that lets you access the parent and child nodes for each DOM element (including the first child)?

A

Each DOM element node has a .parentNode and .children property. The property will return a list of the element’s children and return null if the element has no children.

The .firstChild property will grant access to the first child of that parent element.

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

What does DOM stand for?

A

Document Object Model

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

Syntax for keypress event?

A

eventTarget.onkeypress = eventHandlerFunction;

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