Question: use strict; /* Question 02 Implement a function fetchDataForUser, which fetches data from a remote JSON api and then returns a part of it. Since

"use strict";

/* Question 02

Implement a function fetchDataForUser, which fetches data from a remote JSON api and then returns a part of it.

Since this is a network call, it will need to be an asynchronous function and return the data via a callback.

The JSON-based data will be fetched from this URL, and others like it

The callback should be called with two arguments: 1. error: if request comes back with an err, pass it through to this callback. otherwise set this to null 2. data: if there is no error, this should be the object representing the wins and losses for the given username. If there is an error, this should be set to null.

Use the request library (#) to fetch data. The request library is already installed in this project, and you can require and use it.

*/

const fetchDataForUser = function(url, username, callback) { // IMPLEMENT ME };

// Don't change below: module.exports = { fetchDataForUser };

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!