From cb2f1f3977f8d5fff9ca8fec52813b3744694ee3 Mon Sep 17 00:00:00 2001 From: danwil91 Date: Thu, 23 Apr 2020 01:40:40 -0400 Subject: [PATCH 1/2] Modified File --- index.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index bdafe4c8b..73e070fe2 100644 --- a/index.js +++ b/index.js @@ -25,20 +25,19 @@ function addNumbers(num1, num2) { /** * ### Challenge `sayGoodbye` - * - * @instructions - * This function should take an a name as an argument, - * and return a string that says 'Goodbye, {name}. Have a great day.' - * - * For example, if we invoke `sayGoodbye` - * passing 'Andy' as the argument, - * the returned value should look like: 'Goodbye, Andy. Have a great day.' - * -*/ -function sayGoodbye(/* code here */) { - /* code here */ + * @instructions This function should take an a name as an argument, +and return a string that says 'Goodbye, {name}. Have a great day.' + +For example, if we invoke `sayGoodbye` +passing 'Andy' as the argument, +the returned value should look like: 'Goodbye, Andy. Have a great day.' + */ +function sayGoodbye(name) { + return `Goodbye, ${name}. Have a great day.`; } +console.log(sayGoodbye('Danay')); + /** * ### Challenge `temperatureCtoF` * @@ -53,10 +52,14 @@ 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 */) { - /* code here */ +function temperatureCtoF(temp) { + const sum = Math.round(temp*9/5+32); + return sum; } +console.log(temperatureCtoF(24)); + + /** * ### Challenge `temperatureInF` * From 5805ed436c4380d338498957ba3f5a24fcedd0b2 Mon Sep 17 00:00:00 2001 From: danwil91 Date: Thu, 23 Apr 2020 10:27:12 -0400 Subject: [PATCH 2/2] modified file --- index.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 73e070fe2..74cbdce10 100644 --- a/index.js +++ b/index.js @@ -77,10 +77,18 @@ console.log(temperatureCtoF(24)); * * Hint: You can call your `temperatureCtoF` function from inside `temperatureInF`. */ -function temperatureInF(/* code here */) { - /* code here */ +function temperatureInF(number, temperature){ + if (temperature === 'F'){ + return number + 'F'; + } + else if (temperature === 'C'){ + return temperatureCtoF(number) + 'F'; + } } +console.log(temperatureInF(88, 'F')); +console.log(temperatureInF(24, 'C')); + /** * ### Challenge `makePersonObject` @@ -98,10 +106,20 @@ function temperatureInF(/* code here */) { * email: "leia@leia.com", * } */ -function makePersonObject(/* code here */) { +function makePersonObject(id, name, email) { /* code here */ + const user = { + id: id, + name: name, + email: email, + } + return user; } +const userLeia = makePersonObject('5', 'Leia', 'leia@leia.com'); +console.log(userLeia); + + /** * ### Challenge `getName` * @@ -115,11 +133,12 @@ function makePersonObject(/* code here */) { * passing { id: 1, name: 'Leia', email: 'leia@leia.com` } as the argument, * the returned value should look like `Hello, my name is Leia`. */ -function getName(/* code here */) { - /* code here */ +function getName(/*code here*/){ + /*code here*/ } + /** * ### Challenge `appleIndex` *