Complete the code to access the first character of the string.
const firstChar = str[1];Strings in JavaScript can be accessed like arrays using square brackets []. So str[0] gives the first character.
Complete the code to find the length of the string.
const length = str[1];The length of a string is accessed using the .length property without parentheses.
Fix the error in the code to convert the string to uppercase.
const upper = str[1];The correct method to convert a string to uppercase is toUpperCase() with exact casing.
Fill both blanks to extract a substring from index 2 to 5.
const sub = str[1]([2], 5);
The substring method extracts characters from the start index up to but not including the end index. So str.substring(2, 5) extracts characters at indices 2, 3, and 4.
Fill all three blanks to create a new string by repeating 'Hi' 3 times and converting to lowercase.
const newStr = '[1]'.[2]([3]).toLowerCase();
The repeat method repeats a string a given number of times. So 'Hi'.repeat(3) creates 'HiHiHi'. Then toLowerCase() converts it to lowercase.
