Server-Side Scripting/Strings and Files/Node.js (Express)

routes/lesson5.js
";   return result }

function processLine(line) { // skip heading let index = line.indexOf("Country,MaximumTemperature"); if (index >= 0) { return; }

// find temperature let start = line.indexOf(","); let end = line.indexOf("°C"); if (start < 0 || end < 0) { global.forEach += "Invalid file format"; return }

let celsius = Number(line.substring(start + 1, end)); let fahrenheit = celsius * 9 / 5 + 32;

global.forEach += " " + celsius + " "; global.forEach += " " + fahrenheit.toFixed(1) + " "; }

module.exports = router;

Try It
Copy and paste the code above into the following free online development environment or use your own compiler / interpreter / IDE.
 * Repl.it