4.
What is the problem with the following code?
function greet(name: string, age: number): void {
console.log(`Hello, ${name}! You are ${age} years old.`);
}
There is no problem with the code.
The console.log statement is missing a semicolon.
The function is missing a parameter.
The return type is incorrectly specified.
Correct: A
There is no problem with the code. The function greet takes in two parameters, name and age, with the respective types of string and number. It then logs a greeting message to the console, using string interpolation to include the values of the parameters. The code does not contain any errors or issues.