Skip to content

Instantly share code, notes, and snippets.

@kingvellz
Created January 3, 2023 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingvellz/525885c463948c94fbaa5e731bc2b98f to your computer and use it in GitHub Desktop.
Save kingvellz/525885c463948c94fbaa5e731bc2b98f to your computer and use it in GitHub Desktop.
formatWeatherReport
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