TypeScript Code Completion Medium +20 XP
Readonly Array
Complete the type for an immutable string array.
TypeScriptFill in the blank
const tags: ___ string[] = ["ts", "js"];Type the missing code
Show answer and explanation
Answer: readonly
readonly string[] prevents push, pop, and other mutations. The array contents cannot be changed after assignment.
Hint: Which modifier makes the array immutable?
What this challenge tests
Code Completion in TypeScript: readonly, arrays.