Predict Const Assertion Output
Predict Output Medium
Question
What does this code print?
Code
const config = {
status: "active",
count: 5,
} as const;
console.log(config.status);
console.log(config.count);
Hint
as const makes types narrower but values stay the same at runtime.
Explanation
The as const assertion makes config.status the literal type "active" and config.count the literal type 5 (instead of string and number). At runtime, the values are unchanged. Output: active and 5.
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.