AI Hints
Home›TypeScript Tutorial›Cart Practice and Unions
TypeScript · Lesson 29 of 120

Objects Quiz

Test yourself.

⏱ 2 min read▶ Video at 22:36🎓 Free
Watch this lesson in the TypeScript courseWatch on YouTube ↗Full TypeScript course

Let's review objects. Pause after each question, and answer before I do.

Objects Quiz
From the video: Objects Quiz
  • Objects quiz
  • Pause and think
  • Then check

Question 1

How do you make a property optional? With a question mark after its name.

Quick check
An optional property is written:

Question 2

Which keyword stops a property from changing? Readonly.

Quick check
To stop changes, use:

Question 3

How does an interface build on another? With extends.

Quick check
An interface builds on another with:

Question 4

How do you type a dictionary with any string keys? With an index signature.

Quick check
Any string keys, number values:

Summary

Well done. Next, a new section on unions, starting with union types.

Key takeaways
  • phone?
  • readonly
  • extends
Next up: Union Types — this or that