I used to access individual characters of a string using string[n].
But when I do this in IE8 it always returns undefined when I do this.
I can use string.substr(n, 1) to do the same thing, but the syntax is much longer. Why did they do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That form of character access is not part of the ECMAScript standard, but is implemented by some VMs. I would go with charAt as RoBorg suggested and avoid unstandardized features.