diff --git a/index.js b/index.js index 3a474a3f4..f3ddf938b 100644 --- a/index.js +++ b/index.js @@ -37,9 +37,11 @@ function addNumbers(num1, num2) { * */ function sayGoodbye(/* code here */) { + const name = 'Jeanelle' /* code here */ + return 'Goodbye, ${name}. Have a great day.'; } - +console.log(sayGoodbye("Jeanelle")); /** * ### Challenge `temperatureCtoF` * @@ -54,9 +56,12 @@ function sayGoodbye(/* code here */) { * Hint 1: The formula for converting celsius to fahrenheit is t*9/5 + 32 where t is the temperature in celsius. * Hint 2: There is a very easy way to round numbers in JS. Do a google search to find out how. */ -function temperatureCtoF(/* code here */) { +function temperatureCtoF(temperature /* code here */) { + return Math.round(temperature * (9 / 5) + 32); + /* code here */ } +console.log(temperatureCtoF(24)); /** * ### Challenge `temperatureInF` @@ -75,9 +80,17 @@ function temperatureCtoF(/* code here */) { * * Hint: You can call your `temperatureCtoF` function from inside `temperatureInF`. */ -function temperatureInF(/* code here */) { +function temperatureInF(temperature, unit/* code here */) { /* code here */ + if (unit === "F"){ + return (temperature + unit); + } + else if (unit === "C"){ + return (temperature + "F"); + } } +console.log(temperatureCtoF(88)); +console.log(temperatureCtoF(24)); /**