Review, Research, and Discussion
Describe what Array.map() does :
The map() method creates a new array populated with the results of calling a provided function on every element in the calling array so the map() method creates a new array with the results of calling a function for every array element. The map() method calls the provided function once for each element in an array, in order. map() does not execute the function for empty elements. map() does not
Describe what Array.reduce() does :
The reduce() method executes a reducer function (that you provide) on each element of the array, resulting in a single output value so the reduce() method executes a reducer function for each value of an array. reduce() returns a single value which is the function’s accumulated result. reduce() does not execute the function for empty array elements. reduce() does not change the original array.
Provide code snippets showing how to use superagent() to fetch data from a URL and log the result
- With normal Promise .then() syntax:
SuperAgent is a small HTTP request library that may be used to make AJAX requests in Node. js and browsers
superagent.get(url).then(reult=>{consle.log(result)}.catch(err=>{consle.log(err)}
- with async / await syntax:
let getData=async()=>{ let data=await superagent.get(url)consle.log(data.body)}; grtData()