Node Ecosystem, TDD, CI/CD
-
Describe (in plain English) what
Array.map()does- this will go through all the elements in the array and calls the given function for each in order
-
Describe (in plain English) what
Array.reduce()does- it will execute a reducer function for each value in an array and return a single accumulated result of the given function
-
Provide code snippets showing how to use
superagent()to fetch data from a URL and log the result-
With normal Promise
.then()syntaxsuperagent.get('path to api') .then( data => { console.log(data.body); }) .catch(err => console.error(err)); -
Again with
async/awaitsyntaxasync function getCity(city) { let response = await superagent(`https://geocode.xyz/${city}?json=1`); console.log(`${city}'s latitude is ${response.body.latt} and longitude is ${response.body.longt}`); } getCity('seattle');
-
-
Explain promises as though you were mentoring a Code 301 level student
- promises represent processes that are already happening in the background and will return you the result once finished. this will prevent any blockage of running other codes.
-
Are all callback functions considered to be Asynchronous? Why or Why Not?
- Callback functions are not asynchronous by default. They are depended on the nature of the higher order functions.