Intermediate
Two Loggers, One Contract
The Logger interface and the run function are written. Write two classes that implement Logger: MemoryLogger, which stores every message in a public lines array, and PrefixLogger, which takes a prefix in its constructor and prints prefix + message with console.log.
The program should print [app] start, [app] end and then 2.
What Check tests
- Your code has no type errors
- The console prints
[app] start,[app] endand2 - Both classes say
implements Logger - A class missing
logdoes not satisfy Logger
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Press Run to see the page.
Console
Nothing printed yet.