Question 10
Back to Exercise
The code below stops with an uncaught error. Which statement correctly describes the problem?
const name = "Ame\u0301lie"; // e + combining accent
console.log(name.normalize("NFC").length);
console.log(name.normalize("UTF8").length);
- A It prints 7 and 7
- B It prints 6, then RangeError: "UTF8" is not one of NFC, NFD, NFKC or NFKD Correct
- C It prints 6 and 6
- D SyntaxError
Correct Answer: Option B
NFC combines e + accent into é (6 characters instead of 7). normalize accepts only the four Unicode forms; anything else throws a RangeError.
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!