2.
What is the type of animal in the code example below?
const animal: string = "lion";
undefined
string
number
boolean
Correct: B
In the given code example, the variable animal is assigned the value "lion" using type annotation. The type annotation : string indicates that the variable should hold a string data type. Therefore, the correct answer is string.