Aabha · Learn by building

Exercise 08: Separate and investigate

Use a copy of examples/08.

A. Predict

Change the import to ./missing-labels.js. Does the rest of app.js run? Which tool panel gives the first useful clue?

B. Repair a logic error

Temporarily make seatLabel(0) return “0 places available”. Run the assertions. Explain why the syntax is valid but the behavior is wrong. Restore the required result.

C. Transfer

Move your canFit function from exercise 04 into capacity.js as a named export. Import it into app.js and add checks for 0, a fractional request and a request above capacity. Set a breakpoint inside it and inspect one call.

Evidence

A working two-module program and a short debugging record: expected result, observed result, cause, fix and rerun.

Return to lesson · Explained answer