Romaji to Kana Converter: React & Next.js — Chapter 3, Exercise 2 ===================================================================== TASK Verify with real code that convert('kekkon') ("marriage," けっこん -- a genuine doubled-k sokuon) and convert('sannin') ("three people," さんにん -- a genuine doubled "n" that must resolve cleanly through the syllabic-n fix, not the sokuon check) both produce the correct result, and explain why each one exercises a genuinely different part of this chapter's own logic. SOLUTION Real, verified output: > convert('kekkon') { hiragana: 'けっこん', katakana: 'ケッコン' } > convert('sannin') { hiragana: 'さんにん', katakana: 'サンニン' } Both match the real words exactly. "kekkon" exercises the sokuon check specifically: "kk" is a doubled consonant, and 'k' is not excluded the way 'n' is, so isDoubledConsonant fires correctly, consuming the first "k" as っ and leaving the second "k" to correctly start the next real token, "ko". "sannin" is a genuinely different case, and it's the one this chapter's own third bug was found and fixed against. "nn" is also a doubled pair of the same letter, but the sokuon check's own isDoubledConsonant condition explicitly excludes c0 !== 'n', so the sokuon branch never fires for it at all -- correctly, since a doubled n in romaji represents two separate, real syllabic-n-adjacent elements, not a sokuon. Instead, the first "n" is matched normally as the syllabic-n token (ん), and per this chapter's own fix, matching that token sets lastVowel to null rather than to the literal character 'n'. That's exactly what stops the second "n" from being misread as a chōon continuation of a fake "n vowel" -- the bug this chapter demonstrated directly with "annai" earlier. With the fix in place, the second "n" is free to be matched normally too, giving the correct さんにん. So "kekkon" tests that the sokuon check correctly fires when it should, and "sannin" tests that the sokuon check correctly does NOT fire on a doubled n, and that the syllabic-n fix correctly prevents the chōon check from misfiring in its place. The two words are a matched pair proving the "n exclusion" logic works from both directions at once. WHY THIS WORKS AS AN ANSWER ---------------------------- It verifies both real words with real code, and distinguishes which specific piece of logic each one actually exercises -- the sokuon check firing correctly for "kekkon," and the syllabic-n chōon fix preventing a false positive for "sannin" -- rather than treating both as generic "doubled letter" tests that happen to both pass.