Complete the code to convert the string to uppercase using a built-in method.
const word = 'hello'; const upperWord = word.[1](); console.log(upperWord);
The toUpperCase() method converts all letters in a string to uppercase.
Complete the code to find the length of the array using a built-in property.
const fruits = ['apple', 'banana', 'cherry']; const count = fruits[1]; console.log(count);
The length property gives the number of items in an array.
Fix the error in the code to join array elements into a string separated by commas.
const colors = ['red', 'green', 'blue']; const result = colors.[1](','); console.log(result);
The join() method combines array elements into a string with a specified separator.
Fill both blanks to create an object with keys as words and values as their lengths, only for words longer than 3 letters.
const words = ['cat', 'elephant', 'dog', 'lion']; const lengths = Object.fromEntries(words.filter(word => word.length > 3).map(word => [[1], [2]])); console.log(lengths);
Use word as the key and word.length as the value. word.length is a property, not a function.
Fill all three blanks to create a new array with uppercase words that have length greater than 3.
const words = ['sun', 'moon', 'star', 'sky']; const result = words.filter(word => word.[1] > [2]).map(word => word.[3]()); console.log(result);
Filter words with length greater than 3, then convert each to uppercase using toUpperCase().