0

Is there a way in javascript to split a word such as

"팔꿈"

into an array

[ㅍ,ㅏ,ㄹ,ㄱ,ㄱ,ㅜ,ㅁ]?

I'm trying to check for correct inputs for a word rather than the whole word itself.

this package has helped https://github.com/e-/Hangul.js

1 Answers1

1

Not exactly, but close enough, by using normalization form D (NFD), i.e. canonical decomposition:

console.log(Array.from("팔꿈".normalize ('NFD')));    // returns ['ᄑ', 'ᅡ', 'ᆯ', 'ᄁ', 'ᅮ', 'ᆷ']
  • That's pretty interesting, I guess I should have added this in my original comment, but I'm trying to compare inputs with a word. So I can check the accuracy on each input rather than the completed character. – Christian Rudder Aug 14 '22 at 01:26