Prepare for the Salesforce JavaScript Developer Exam. Utilize comprehensive quizzes, flashcards, and multiple choice questions with hints and explanations. Boost your exam readiness!

Practice this question and more.


What will the console output be when searching for uppercase letters in a given paragraph?

  1. ["T"]

  2. ["T", "I"]

  3. ["I"]

  4. ["t", "i"]

The correct answer is: ["T", "I"]

When searching for uppercase letters in a given paragraph, the output typically consists of all uppercase letters found in the string. If the paragraph includes the uppercase letters "T" and "I", then the function designed to identify uppercase letters would successfully extract both of these characters. In the context of JavaScript, the use of regular expressions with the `match` method could facilitate this search. For instance, a regular expression pattern like `/[A-Z]/g` will capture all uppercase letters in the input string. If the letters "T" and "I" are indeed part of the paragraph, the resulting output would be an array that contains both of these uppercase letters. Therefore, the output would correctly be an array containing "T" and "I", reflecting the uppercase letters present in the paragraph. This reasoning aligns with the choice provided, making it a valid answer for the question posed.