Constructors cannot be async. Write a CourseReport class with a static async create(courseId) factory that loads data before returning a ready instance, and a summary() method.
JavaScript Basics: 4 students, average 79.0
Error: course py999 not found
The factory awaits the loading and only then calls the synchronous constructor, so callers always receive a fully initialised object (or a rejected promise).
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!
We use Google Analytics cookies to see how LearnFrenzy is used and make it better, and Google AdSense to keep it free.
No analytics or ad cookies are set until you accept. Privacy Policy
·
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!