Courses
JavaScript Intermediate: Write Code That Doesn't Fall Apart When the Data Changes
Check Yourself: Prove It Works Before Someone Else Finds Out
Five scenario questions on try/catch, custom errors and tests. If you miss more than one, reread the lesson that covers it.
Course content
Join this Course
Sign in to save your progress.
-
Set Up Projects That Don't Break Each Other
-
Node.js and npm: Running JavaScript Outside the Browser
-
package.json and Lock Files: Same Install Every Time
-
-
-
Organize Code Other People Can Read
-
JavaScript Modules: import, export and Splitting One Big File
-
JavaScript Classes: When an Object Literal Is No Longer Enough
-
Destructuring and Spread Without the Confusion
-
-
-
Work With Real Data
-
Array Methods: map, filter, reduce and When a Loop Is Clearer
-
Working With JSON: parse, stringify and What Breaks
-
Dates in JavaScript Without Losing a Day
-
-
-
Waiting for Things
-
Callbacks to Promises: Why the Code Runs Out of Order
-
async/await and fetch: Calling a Real API
-
-
-
Prove It Works Before Someone Else Finds Out
-
try/catch and Custom Errors
-
Your First Tests With Vitest
-
-
- Final Check: JavaScript Intermediate
1.
You validate a form and throw ValidationError for bad fields. In catch, what should happen to other errors?
2.
Why give a custom error class this.name = "ValidationError"?
3.
try { saveLater(); } catch {} doesn't catch an error thrown inside the async function saveLater. Why?
4.
Your test expect(applyDiscount(425, 10)).toBe(382.5) fails with "expected 42.5 to be 382.5". What do you do first?
5.
expect(() => applyDiscount(425, 150)).toThrow(RangeError). Why the arrow function?
About
Five scenario questions on try/catch, custom errors and tests. If you miss more than one, reread the lesson that covers it.
- Duration
- 5 min
- Last update
- 08/29/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.