So, we can calculate the average of our average = 0 in the second then callback function:
// Andrew has a 83% in the classconst getStatus = (userId) => { var user; return getUser(userId).then((tempUser) => { user = tempUser; return getGrades(user.schoolId); }).then((grades) => { var average = 0; // average // return our string });};
Now, we've been using const throughout the course. We can actually switch our var over to let; let is the ES6 equivalent to var, so this is a variable whose value we can change:
// Andrew has a 83% in the classconst getStatus = (userId) => { let user; return getUser(userId).then((tempUser) => { user = tempUser; return getGrades(user.schoolId); }).then((grades) => { let average = 0; // average ...