After pulling values from an XML file using JavaScript, I face the challenge of converting a string to an integer in order to perform calculations.
To extract data from the XML file, I use the following snippet:
var pop = JSON.stringify(feature.attributes.Total_Pop.value);
This code serves its purpose. Afterwards, I convert the string to an integer with the following code:
var popint = parseInt(pop);
The conversion is successful. However, when attempting mathematical operations on the integer, it returns NAN.
For my math operation, this is the code snippet I utilize:
var pop6 = Math.ceil(popint / 30);
What could be causing this issue? Any helpful suggestions?