Complete the code to explicitly declare the type of the variable age as number.
let age: [1] = 25;
string type for a numeric value.The variable age is declared with the type number to explicitly specify it holds numeric values.
Complete the code to explicitly declare the type of the function parameter name as string.
function greet(name: [1]) { return `Hello, ${name}!`; }
number type for a text parameter.The parameter name is explicitly typed as string because it represents text.
Fix the error by explicitly typing the variable isActive as a boolean.
let isActive: [1] = true;isActive as string or number.The variable isActive holds a true/false value, so it must be typed as boolean.
Fill both blanks to explicitly type the array scores as an array of numbers and the variable total as a number.
let scores: [1] = [10, 20, 30]; let total: [2] = 60;
scores as string[].total as string or any.scores is an array of numbers, so its type is number[]. total is a single number, so its type is number.
Fill all three blanks to explicitly type the object person with name as string, age as number, and isStudent as boolean.
let person: { name: [1]; age: [2]; isStudent: [3] } = {
name: "Alice",
age: 22,
isStudent: false
};any instead of specific types.The object person has name as a string, age as a number, and isStudent as a boolean, so the types must match accordingly.