From 98c2083a7d3a3f15a17685e3bbce5efdc9673cd4 Mon Sep 17 00:00:00 2001 From: Jeanellle96 Date: Thu, 28 May 2020 21:22:09 -0700 Subject: [PATCH 1/3] MVP has not been finished --- index.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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)); /** From 97a2ade0744d49d683be9431a66756a29364c763 Mon Sep 17 00:00:00 2001 From: Jeanellle96 Date: Thu, 28 May 2020 21:36:15 -0700 Subject: [PATCH 2/3] MVP is not finished --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f3ddf938b..8accb769e 100644 --- a/index.js +++ b/index.js @@ -109,8 +109,9 @@ console.log(temperatureCtoF(24)); * email: "leia@leia.com", * } */ -function makePersonObject(/* code here */) { +function makePersonObject(id, name, email/* code here */) { /* code here */ + const = } /** From 830adc60118b469b594bef1e80132fe61b6ad203 Mon Sep 17 00:00:00 2001 From: Jeanellle96 Date: Sun, 31 May 2020 20:32:14 -0700 Subject: [PATCH 3/3] Added more code --- index.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 8accb769e..de2b3c22c 100644 --- a/index.js +++ b/index.js @@ -109,10 +109,16 @@ console.log(temperatureCtoF(24)); * email: "leia@leia.com", * } */ -function makePersonObject(id, name, email/* code here */) { +function makePersonObject(id, name, email) { /* code here */ - const = + const thisPerson ={ + id:id, + name:name, + email:email, + }; + return thisPerson; } +console.log(makePersonObject(5,"Leia", "leia@leia.com")); /** * ### Challenge `getName` @@ -127,10 +133,16 @@ function makePersonObject(id, name, email/* 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 */) { +function getName({newPerson}) { /* code here */ + return ('Hello, my name is ${this.name}'); } - +const thisPerson ={ + id:5, + name:"Leia", + email: "leia@leia.com", +}; +console.log(getName(thisPerson)); /** * ### Challenge `appleIndex` @@ -147,9 +159,12 @@ function getName(/* code here */) { * passing in [ 'orange', 'grape', 'apple', 'banana', 'mango' ] as the argument, * the returned value should be: 2. */ -function appleIndex(/* code here */) { +function appleIndex(array/* code here */) { /* code here */ + const fruits = [ 'orange', 'grape', 'apple', 'banana', 'mango']; + return fruits.indexOf(array) } +console.log(appleIndex('apple')); /** * ### Challenge `isItAnApple`