A note that may be missing
A missing note and an empty note are different inputs.
your task
Keep note optional. Return “No note” when it is missing. For a present note, trim its text and keep the “Note: ” prefix, including its space. The type check and all cases must pass.
A booking can omit its note. The starter stops when it tries to trim that missing value. A booking with an empty string still has a note.
Run code does two things. First the compiler checks the types and lists each error with its line. Then your code runs once for each case. A type error does not stop the run. The exercise is solved when there are no type errors and every case passes.
Starter code
or press Ctrl EnterNot run yet
type check
Not run yetnotes.ts
Expected result: no type errors.
cases
Not run yetA note with surrounding spaces
Expected output
1
Note: Late arrivalSee the input and the code for this case
console.log(noteLine({ room: "Atlas", note: " Late arrival " }));Not run yetA missing note
Expected output
1
No noteSee the input and the code for this case
console.log(noteLine({ room: "Birch" }));Not run yetAn empty note
Expected output
1
Note: See the input and the code for this case
console.log(noteLine({ room: "Cedar", note: "" }));