Thursday, October 20, 2005

I've been going through some javascript madness today. I had a simple string:
"/\n", a forward slash and an end of line character. Now I had the string stored in an array of strings.

The statement was:

if (arrofstrings[i] == "/\n")

Even though I know that at least one string in the array of strings is a match, it would fail.

arrofstrings[i].length would return 2. But no matter what I tried it kept failing. And only in Internet Explorer.

I ended up doing:

tempstr = arrofstrings[i];

if tempstr.charAt(0) == "/" {

if (tempstr.charcodeAt(1)) == 13 {


Any clues as to why the above problem happened? It occurred in both IE 5.0 and 6.0.