I have a json file which I am accessing through JS
latitude =data8.weblandmarks8[j].latitude + latitude;
should add all the latitudes so that I could average them later
instead it just concatenates them
How should i achieve what I want to
Json entry
"latitude": "28.14331",
Aside from using
parseFloatyou could convert toNumber, it’s slightly faster and usable for both integers and floats1:1 another advantage for integers is that you don’t need to supply a radix.
Number('09')returns 9, whereasparseInt('09')(i.e.parseIntwithout a radix) returns 0 (that’s becauseparseIntdefaults to an octal – radix 8).