Complete the code to get the length of the string.
const str = "hello"; const length = str[1];
In TypeScript, strings have a length property (without parentheses) to get their length.
Complete the code to get the character at index 2.
const str = "world"; const char = str[1];
In TypeScript, you can access characters in a string using bracket notation like str[2].
Fix the error in the code to convert string to uppercase.
const str = "hello"; const upper = str[1];
The correct method to convert a string to uppercase in TypeScript is toUpperCase() with parentheses.
Fill both blanks to create a new string by repeating 'abc' 3 times.
const base = "abc"; const repeated = base[1]([2]);
Use the repeat method with the number of times to repeat as argument.
Fill all three blanks to create a new string by slicing 'typescript' from index 4 to 7.
const lang = "typescript"; const part = lang[1]([2], [3]);
The slice method extracts part of a string from start index to end index (not including end).
