LearnFrenzy
Sign in Take a free test

String Methods · Predict the Output · Question 19

Upper-casing ß Answer, explanation & discussion

  • Output
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 19 Back to Exercise

What does the following JavaScript code print (console output, as in Node.js)?

main.js
const word = "straße";      // "straße"
console.log(word.toUpperCase(), word.length, word.toUpperCase().length);
  • A STRAßE 6 6
  • B STRASSE 6 7 Correct
  • C STRASSE 6 6
  • D STRAẞE 6 6
Correct Answer: Option B

Case conversion follows Unicode rules: the German ß has no single upper-case letter in the default mapping and becomes "SS", so the length grows.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links