const https = require('node:https'); const getCurrentTemp = function (response) { let body = ""; response.on("data", (data) => { body += data; }); response.on("end", () => { try { let json = JSON.parse(body); console.log(json.current_condition[0].temp_C + "°") } catch (error) { console.error(error.message); }; }); } const requestWeather = function () { let url = "https://wttr.in/" + process.argv[2] + "?format=j1" https.get(url, getCurrentTemp) }