All academies
All challenges

Describe a Book with an Interface

easyinterfaces50 XP

Problem

Define an interface Book with title (string), author (string), and year (number). Then write formatBook(book: Book): string that returns a string in the format "Title by Author (Year)".

Expected output

Dune by Frank Herbert (1965)
Emma by Jane Austen (1815)

Hints

Stuck? Reveal hints one at a time.

Solution

Try solving it yourself first — revealing is always available.

Press Run in the editor — your console output is checked automatically.
No errors
Loading...

Console output appears here. Press Run or just type — the code compiles automatically.