Review, Research, and Discussion
- Describe (in plain English) what Array.map() does
- Its a function deals with arrays through looping in all the elements inside the array and it has a return statement and the length doesnt change.
- Describe (in plain English) what Array.reduce() does
- The reduce() method executes a user-supplied “reducer” callback function on each element of the array, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the array is a single value
- Provide code snippets showing how to use superagent() to fetch data from a URL and log the result
function getCharacters(){ superagent.get(‘https://swapi.dev/api/’) .then(respond=>console.log(respond.body)) .catch(err=>console.log(err)) }
- Explain promises as though you were mentoring a Code 301 level student
- Promises are used to handle asynchronous operations in JavaScript. They are easy to manage when dealing with multiple asynchronous operations where callbacks can create callback hell leading to unmanageable code.
- Are all callback functions considered to be Asynchronous? Why or Why Not?
- Is callback function synchronous or asynchronous? The callback will be synchronous when the higher order function which calls it is calling it synchronously. Inversely if it is called within the context of the execution branch of an asynchronous operation it will be asynchronou