Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
request.callback = function(message, value)
{
if (Request.responseComplete == message) {
let root = XML.parse(value);
let cityElement = root.elements.find(element => "city" == element.name);
let valueAttribute = cityElement.attributes.find(attribute => "name" == attribute.name);
let city = valueAttribute.value;
let temperatureElement = root.elements.find(element => "temperature" == element.name);
valueAttribute = temperatureElement.attributes.find(attribute => "value" == attribute.name);
let temperature = Number.parseFloat(valueAttribute.value);
let weatherElement = root.elements.find(element => "weather" == element.name);
valueAttribute = weatherElement.attributes.find(attribute => "value" == attribute.name);
let weather = valueAttribute.value;
trace(`The temperature in ${city} is ${temperature} F.\n`);
trace(`The weather condition is ${weather}.\n`);
}