Possible Duplicate:
string.charAt(x) or string[x]?
It seems that "asdf"[0] produces "a". So why would anyone ever type out "asdf".charAt(0)?
Is that shorter syntax safe to use?
Cross browser compatibility? That’s about all I can think of.
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.
You can only access strings as arrays in newer browsers. To support older browsers (i.e. IE7) you have to use
charAt.Related: string.charAt(x) or string[x]?