I have a string, and I need to get its first character.
var x = 'somestring'; alert(x[0]); //in ie7 returns undefined
How can I fix my code?
Advertisement
Answer
charAt
can give wrong results for Unicode. Use Array.from
:
Array.from('some string')[0];