In my codebase I have this code, surprisingly it returns 1:
'トゲ'.indexOf('ケ') // Returns 1
The character ケ
doesn't seem to appear in string トゲ
.
I also tried to run this code:
'トゲ'.charAt(1) // Returns `ケ`
And to my surprise it returns ケ
.
Can you explain why the codes above return 1 and ケ
? Thank you!
Your string consists of three characters: ト, ケ and ゙. There is no dedicated halfwidth-ge character, you'll always use a regular halfwidth character and add the halfwidth voiced sound mark to it, which will be rendered as the combined glyph ゲ.
Note that there is a dedicated fullwidth ゲ KATAKANA LETTER GE U+30B2.