Question 16
Back to Exercise
What does the following JavaScript code print (console output, as in Node.js)?
const composed = "é"; // é as one character
const decomposed = "é"; // e + combining acute accent
console.log(composed === decomposed, composed === decomposed.normalize(), decomposed.length);
- A true true 1
- B false false 2
- C false true 1
- D false true 2 Correct
Correct Answer: Option D
The two strings look the same but contain different code units. normalize() (NFC by default) composes e + accent into é.
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!