Returning the template string

Just above the console.log statement for average, we're going to follow this format starting off with the name, that is, user.name. Then we're going to move on to the next part, has a, followed by their grade. That's the average. We'll toss the % after it in the class period:

return `${user.name} has a ${average}% in the class.`;

Now that we're returning something, this value will be accessible to whoever calls getStatus. In this case, that happens right here. In the Terminal, we see Jessica has 100% in the class printing to the screen:

If I go on to 1, we see Andrew has an 83 and, if I type in some other id

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.