Google News
logo
TypeScript - Quiz(MCQ)
What does the 'readonly' access modifier do for an array variable assignment like: 'const codeNames: readonly string[] = ['Coding', 'God']'?
A)
Makes you read it for better clean code
B)
Allows only adding but not deleting elements in the array
C)
Makes it private and can only be used in the file its created
D)
Allows no changes and is there simply to be read from and not modified

Correct Answer :   Allows no changes and is there simply to be read from and not modified

Advertisement