- COMP.CS.200
- 7. JavaScript: FP & async (assignment)
- 7.11 JS3: Attendance and activity
JS3: Attendance and activity¶
FP¶
map(), filter(), and reduce() are so called higher-order functions? What does it mean?
Functions are the first-class citizens. What does this mean - give an example
Functions can be declarations or expressions. Please explain the following snippet:
const numbers = [1, 2, 3, 4]; const addFive = (numbers) => [...numbers, 5] addFive(numbers);
Async: Promise¶
What is the purpose of the two parameters in the Promise constructor’s callback argument?
const promise1 = new Promise((resolve, reject) => { resolve('Success!'); });
How do you get the return value of a resolved Promise?
What do we mean by “happy path” in the context of a promise chain?
How would you get access to the rejected value ‘Fail!’? There are multiple alternatives - itemize
const promise2 = new Promise((resolve, reject) => { reject('Fail!'); });
Can the Promise chain be continued after catch()? Give a rationale
Async: Fetch¶
fetch() is AJAX enabler. What is AJAX - why do we need it?
What is a query string? What is the separator between key-value pairs?
What HTTP method benefits from query string? What are the other HTTP methods?
Why does fetch() return a Promise? What does async keyword signify?
What implications are there if you await fetch() to finish?
Co-authors¶
Here, the sociogram is constructed as SVG. What is SVG?
What is XML? Why AJAX is called Asynchronous JavaScript and XML?
What is JSON? What is the relation between object literal notation and JSON?
What is the structure of HTTP response? Where is JSON put?
Header-wise, what is the difference between sending HTML or JSON content?
Why would you select XML? Why JSON?
A+ presents the exercise submission form here.