I have a variable:
var text = "hello";
I want to get the 0 positioned character, so:
var firstChar = text[0];
Simple. In firefox and chrome this works. In IE however i always get back ‘undefined’
Any ideas why this might be happening in IE?
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.
Strings aren’t accessible like arrays in IE (prior to IE9). Instead you can use
charAt, which is available cross-browser: