JavaScript Flashcards

1
Q

What arguments are required by the fetch( ) method in the ‘weather-forecast app’; what does it return as output, and what is the method that serves this output?

A

Mandatory resource path: url

Input element’s id: #location

API Key: apiKey

Returns a Promise: response

.then(function(response) { … }

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

What methods are used to update the activities list in the weather-forecast app, and what arguments do they take?

A

Document.querySelectorAll(‘.options div’)

.forEach(function (el) { … }

El.addEventListener(‘click’, … )

UpdateActivityList // as argument in addEventListener.

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

What are the state object variables in the weather-forecast app?

A

Condition: response.weather[0].main

Icon: “http://openweathermap.org/img/w/“ + response.weather[0].icon + “.png”

DegC: response.main.temp

City: response.name

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

What conditional logic is used in the updateUISuccess(response) method to parse data into the .conditions div?

A
fragment = document.createDocumentFragment( ),
container = document.createElement('div');

fragment.appendChild(container);

if (document.querySelector(‘.conditions div’)) {
into.replaceChild(fragment, document.querySelector(‘.conditions div’));
}
else {
into.appendChild(fragment);
}

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

handleResize();

A

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

window.addEventListener

A

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

componentWillUnmount

A

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