Created
January 3, 2023 14:33
-
-
Save kingvellz/525885c463948c94fbaa5e731bc2b98f to your computer and use it in GitHub Desktop.
formatWeatherReport
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToFahrenheit(tempc){ | |
return tempc * 9/5 + 32; | |
} | |
function formatTemperatureAsString(tempc, convertToF){ | |
if (convertToF === true){ | |
return convertToFahrenheit(tempc) + "°F"; | |
} | |
else { | |
return tempc + "°C"; | |
} | |
} | |
function convertToEmojiFace(tempc){ | |
if (tempc > 30){ | |
return "🥵"; | |
} | |
else if (tempc > 12){ | |
return "😊"; | |
} | |
else { | |
return "🥶"; | |
} | |
} | |
function formatWeatherReport(cityName, tempc, showFahrenheit){ | |
} | |
let result = formatWeatherReport('Vancouver', 6, true); | |
console.log(result);// "In Vancouver it is currently 🥶 42.8°F" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment