Predict Function Return Output
Predict Output Easy
Question
What does this code print?
Code
function add(a: number, b: number): number {
return a + b;
}
function greet(name: string): string {
return `Hello, ${name}`;
}
console.log(add(3, 4));
console.log(greet("Ada"));
Hint
Return type annotations are erased at runtime — just compute the values.
Explanation
add(3, 4) returns 7. greet("Ada") returns "Hello, Ada" using a template literal. The type annotations are compile-time only and have no runtime effect. Output: 7 and Hello, Ada on separate lines.
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.