
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com
Mobile version of this page
Too much Python makes Peter a shit Javascript developer
12th of March 2009
This murdered a good half hour of my time splattered with lots of alert() statements to debug. Basically, in Firefox you can do this:
var word = "Peter";
alert(word[1]); // "e" in Firefox, undefined in IE
alert(word[1]); // "e" in Firefox, undefined in IE
This is the wrong way to get to character in a string in Javascript. The correct way is to use charAt() like this:
var word = "Peter";
alert(word.charAt(1)); // "e" in Firefox and IE
alert(word.charAt(1)); // "e" in Firefox and IE
I don't know about the other browsers but finally Crosstips.org now works in IE7 too. I haven't even looked at it in IE6 and don't intend to either.

