Ok so I am rather stumped by this one.
myStringVar = myStringVar.trim()
var arr = myStringVar.split('')
The most likely answer for this is that you have some invisible Unicode character in your string (for instance,
"", U+2063 INVISIBLE SEPARATOR).
A string containing only such a character would look to a user (or programmer) like an empty string, but would infact have length 1 since it does contain a character.
One simple way to test if this is the case, is to get the Unicode character code of the character in the string with
string.charCodeAt(0). You can then look this up value in a Unicode table (such as this one), which should tell you if you have an invisible character in your string.