Color theme
0 day streak0 XPP1
TypeScriptQuiz mode
MISSION 1 OF 3

Describe a meeting room

0 XP earned
TypeScript track: IntermediateMission: IntermediateObject typesProperty typesType annotations
Before you start this intermediate track

JavaScript objects and functions. The lessons introduce narrowing, unions, and optional properties.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 6 challenges
KNOWLEDGE CHECK

Predict the result.

What room label is logged?

mission.ts
type Room = { name: string; capacity: number };const room: Room = { name: "Cedar", capacity: 6 };const label = `${room.name}: ${room.capacity} seats`;console.log(label);

Use TypeScript 5+ with strict checking and an ES2020 target. Each mission is an independent file. Compile the TypeScript to JavaScript, then run it with Node.js or in a browser console.

Review the lesson

An object type spells out the properties a value must provide and the type of each property. Here, Room requires a text name and a numeric capacity. Annotating room lets TypeScript check that shape before the code runs. The values remain ordinary JavaScript properties when the program builds its display label.

Choose your answer+25 XP on first completion