Fill: Const Assertion
Fill in the Blank Medium
Question
Fill in the blank to make the array have literal element types:
Code
const colors = ["red", "green", "blue"] ___;
Hint
as const narrows types to their most specific literal forms.
Explanation
The assertion is as const. Without it, colors would be string[]. With as const, colors becomes readonly ["red", "green", "blue"] — a readonly tuple with literal types. This is useful for exhaustiveness checking.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.