From d108c1d1d870e040a0825738b9596cd9d3c65776 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 30 Apr 2020 21:38:08 -0500 Subject: [PATCH 1/3] Task 1 done. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index bdafe4c8b..26a19afc6 100644 --- a/index.js +++ b/index.js @@ -35,8 +35,8 @@ function addNumbers(num1, num2) { * the returned value should look like: 'Goodbye, Andy. Have a great day.' * */ -function sayGoodbye(/* code here */) { - /* code here */ +function sayGoodbye(name) { + return `Goodbye, ${name}. Have a great day.` } /** From e69aadc3975b952ed0e89a7415cbd27e26f9e1c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 May 2020 15:23:25 -0500 Subject: [PATCH 2/3] Challenges 1-3 --- index.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 26a19afc6..32f574f2b 100644 --- a/index.js +++ b/index.js @@ -53,8 +53,10 @@ function sayGoodbye(name) { * 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(degree) { + + C = Math.round(degree * 9 / 5) + 32; + return C; } /** @@ -74,8 +76,16 @@ function temperatureCtoF(/* code here */) { * * Hint: You can call your `temperatureCtoF` function from inside `temperatureInF`. */ -function temperatureInF(/* code here */) { - /* code here */ +function temperatureInF(degree,unit) { + C = Math.round(degree * 9 / 5) + 32; + + if (unit === "F") { + + return degree + unit; + } + else { + return C + "F"; + } } @@ -95,8 +105,13 @@ function temperatureInF(/* code here */) { * email: "leia@leia.com", * } */ -function makePersonObject(/* code here */) { - /* code here */ +function makePersonObject (a,b,c) { + let person = { + id: a, + name: b, + email: c + }; + return person.id + person.name + person.email; } /** From 8f52daa61e26724336a29f31c6b6deeea528b3e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 May 2020 17:58:01 -0500 Subject: [PATCH 3/3] completed more challenges --- index.js | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 32f574f2b..80861986a 100644 --- a/index.js +++ b/index.js @@ -105,13 +105,13 @@ function temperatureInF(degree,unit) { * email: "leia@leia.com", * } */ -function makePersonObject (a,b,c) { +function makePersonObject (a, b, c) { let person = { id: a, name: b, email: c }; - return person.id + person.name + person.email; + return person; } /** @@ -127,8 +127,13 @@ function makePersonObject (a,b,c) { * 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 (a,b,c) { + let person = { + id: a, + name: b, + email: c + }; + return `Hello, my name is ${person.name}.`; } @@ -147,8 +152,11 @@ function getName(/* code here */) { * passing in [ 'orange', 'grape', 'apple', 'banana', 'mango' ] as the argument, * the returned value should be: 2. */ -function appleIndex(/* code here */) { - /* code here */ +function appleIndex(a,b,c,d,e) { + + let fruit = [a,b,c,d,e]; + + return fruit.indexOf(c) } /** @@ -165,10 +173,20 @@ function appleIndex(/* code here */) { * For example, if we invoke `isItAnApple` * passing in [ 'orange', 'apple', 'banana', 'apples', 'apple', 'mango' ] as the argument, * the returned value should be: [ false, true, false, false, true, false ]. -*/ -function isItAnApple(/* code here */) { - /* code here */ -} + */ +let fruit = [a,b,c,d,e,f]; +function isItAnApple(fruit) { + + for (i = fruit.indexOf[0]; i < fruit.length; i++) { + + if (fruit.indexOf[i]===`apple`) { + return `true`; + } + else { + return `false`; + } + } + }