user669677
user669677

Reputation:

my function returns undefined in IE

The is a problem in my function(ar), that makes this with int:

912165161

912 165 161 Ft

It works well everywhere except in IE. Why can it be?

function ft(ar)
{
    ar = ar.toString();
    var len = ar.length; //1234    
    var ret = "";
    var j = -1;
    for(var i = len-1;i>=0;i--)
    {
        j++;
        ret = ar[i]+ret;    
        if(j == 2 || j==5 ||j==8)ret = " "+ret;    
    }
    return ret+" Ft";
}
var code ="{\"osszesen\":1208,\"egy_kep_ara\":53,\"kedvezmeny\":null,\"eredeti-ar\":1208}";
array = $.parseJSON(code);
int = array["osszesen"];
alert(int);
alert(ft(int));

http://jsfiddle.net/9WLGF/13/

Upvotes: 2

Views: 199

Answers (1)

user669677
user669677

Reputation:

I had to replace ar[i] to ar.charAt(i) because the first was not standard

Upvotes: 3

Related Questions