if u r familiar with Javascript can u tell what will be the output of these lines ?

var src="abcd";
var dest="";
for (var i=0;i<4;i++)
{
          dest+=src[i];
}
alert(dest);

well, it’s obvious that this fragment will produce a message box holding the string “abcd” unless u r used to code Javascript for IE

in Firefox or Chrome it works like a charm

but in Internet Explorer  -i think till IE 7, i didn’t test it with 8- that will produce “undefinedundefinedundefinedundefined”

so why is that ?!!!!

that is simply because in IE u cant index char in a string using square brackets so u can not use “src[i]”

but instead u use src.charAt(i)

so the fragment would be

var src="abcd";
var dest="";
for (var i=0;i<4;i++)
{
          dest+=src.charAt(i);
}
alert(dest);

and that works fine with the rest of the browsers

i did not look for that in the ECMAscript standard but that thing in IE sucks