toCharArray method error of StringPrototype
Brought to you by:
eye_of_back
<script src="jsjava-2.0.js"></script>
<script>
var arr="abc".toCharArray();
document.write(arr.length);
</script>
run the code in IE browser 6.0 and a error will occurs in the line 3.
I find error in the StringPrototype class:
String.prototype.toCharArray=function(){
if(this==undefined){//ERROR here!
return null;
}
var length=this.length;
var chars=new Array(length);
for(var i=0;i<length;i++){
chars[i]=this.charAt(i);
}
return chars;
};