I have a query about adding a decimal number to a latitude value obtained using forwardGeocoder. Here's the code snippet I am referring to:
Ti.Geolocation.forwardGeocoder(textField.value, function(e) {
var a = e.latitude;
var b = 0.1;
var c = a+b;
Ti.API.info('result c: '+c);
});
The output displayed is:
[INFO] result c: 40.7145500.1
The issue here is that the provided number is not actually being added to the latitude value, but rather just concatenated as a string.
Interestingly, when I tried subtraction operations, it worked flawlessly. Similarly, using custom values for variables a
and b
also yielded accurate results.
Ti.Geolocation.forwardGeocoder(textField.value, function(e) {
var a = 0.1;
var b = 0.1;
var c = a+b;
Ti.API.info('result c: '+c);
});
In this case, the output was:
[INFO] result c: 0.2
If anyone can provide insights on how to effectively add a number to the obtained latitude value, it would be greatly appreciated. Thank you for your assistance in advance.