From 4ccaba5de38269d5a543fc3cd9b336b234aeb515 Mon Sep 17 00:00:00 2001 From: David Veele Date: Thu, 28 May 2020 15:55:48 -0400 Subject: [PATCH 1/5] goodBye function cleared --- index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 3a474a3f4..3a4b68107 100644 --- a/index.js +++ b/index.js @@ -15,14 +15,10 @@ function addNumbers(num1, num2) { return num1 + num2; } +addNumbers(7,5); -// ⭐️ Example Challenge end ⭐️ -// 👇 COMPLETE YOUR WORK BELOW 👇 -// 👇 COMPLETE YOUR WORK BELOW 👇 -// 👇 COMPLETE YOUR WORK BELOW 👇 - /** * ### Challenge `sayGoodbye` @@ -36,10 +32,12 @@ 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) { + console.log(`Goodbye, ${name}. Have a great day.`); /* code here */ } +sayGoodbye('Andy'); + /** * ### Challenge `temperatureCtoF` * From 39bd3b970277560e4e7620443930098a72703f4b Mon Sep 17 00:00:00 2001 From: David Veele Date: Thu, 28 May 2020 16:52:24 -0400 Subject: [PATCH 2/5] temperature conversion functions done --- index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 3a4b68107..299718fd4 100644 --- a/index.js +++ b/index.js @@ -52,10 +52,11 @@ sayGoodbye('Andy'); * 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(celsius) { + let farenheit = celsius*9/5+32; + return Math.round(farenheit) ; } - +temperatureCtoF(24); /** * ### Challenge `temperatureInF` * @@ -73,10 +74,16 @@ function temperatureCtoF(/* code here */) { * * Hint: You can call your `temperatureCtoF` function from inside `temperatureInF`. */ -function temperatureInF(/* code here */) { - /* code here */ +function temperatureInF(temp,unit) { + if (unit === `C`){ + return (Math.round(temp*(9/5)+32))+`F` + } + else{ + return (`${temp}${unit}`); + } } +temperatureInF(24,`C`); /** * ### Challenge `makePersonObject` From cab8a5f2509f86f101ff43e28a0ef1d45fcfcafd Mon Sep 17 00:00:00 2001 From: David Veele Date: Thu, 28 May 2020 17:06:30 -0400 Subject: [PATCH 3/5] finished makePersonObj Function --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 299718fd4..e8c7cfb17 100644 --- a/index.js +++ b/index.js @@ -101,9 +101,12 @@ temperatureInF(24,`C`); * email: "leia@leia.com", * } */ -function makePersonObject(/* code here */) { - /* code here */ +function makePersonObject(id,name,email) { + console.log(`id: ${id},`); + console.log(`name: ${name},`); + console.log(`email: ${email},`); } +makePersonObject(`5`,`Leia`,`leia@leia.com`); /** * ### Challenge `getName` From 29c873b8988a9f2d87a4490b7e4bccefd3a39beb Mon Sep 17 00:00:00 2001 From: David Veele Date: Sun, 31 May 2020 16:45:27 -0400 Subject: [PATCH 4/5] working on functions --- README.md | 12 +++++------- index.js | 54 +++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 4cfee49c0..d341b76d1 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,11 @@ If you run into trouble while coding, fight the good fight for 20 minutes and th ### Task 1 - Set up Project -- [ ] Create a forked copy of this project -- [ ] Add your team lead as collaborator on Github -- [ ] Clone your OWN version of the repository (Not Lambda's by mistake!) -- [ ] Create a new branch: git checkout -b ``. -- [ ] Implement the project on your newly created `` branch, committing changes regularly -- [ ] Push commits: git push origin `` - +- [ x] Create a forked copy of this project +- [ x] Add your team lead as collaborator on Github +- [ x] Clone your OWN version of the repository (Not Lambda's by mistake!) +- [ x] Create a new branch: git checkout -b ``. +- [x ### Task 2 - MVP Find the file `index.js` and complete the tasks until your returns look like the expected returns. Do not use any of the forbidden methods! diff --git a/index.js b/index.js index e8c7cfb17..1d3a6ddc7 100644 --- a/index.js +++ b/index.js @@ -122,9 +122,15 @@ makePersonObject(`5`,`Leia`,`leia@leia.com`); * the returned value should look like `Hello, my name is Leia`. */ function getName(/* code here */) { - /* code here */ + const namObj={ + id:57197, + name: `Shenandoah`, + email: `Shenandoahjeroline@email.com`, + }; + return(`Hello, my name is `+namObj.name) } +console.log(getName()); /** * ### Challenge `appleIndex` @@ -138,13 +144,19 @@ function getName(/* code here */) { * once in the array. * * For example, if we invoke `appleIndex` - * passing in [ 'orange', 'grape', 'apple', 'banana', 'mango' ] as the argument, - * the returned value should be: 2. + * passing in 'orange', 'grape', 'apple', 'banana', 'mango' ] as the argument, + * the returned value should be: 2.[ */ -function appleIndex(/* code here */) { - /* code here */ +function appleIndex() { + let fruit =[`orange`, `grape`,`apple`, `bananan`, `mango`] + return(fruit.indexOf(`apple`)) } +function appleIndex() { + let fruit =[`orange`, `grape`,`apple`, `banana`, `mango`] + return(fruit.indexOf(`apple`)) +} +console.log(fruit[2]); /** * ### Challenge `isItAnApple` * @@ -160,8 +172,14 @@ function appleIndex(/* code here */) { * 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 */ +function isItAnApple(array) { + const fruit2 = [ 'orange', 'apple', 'banana', 'apples', 'apple', 'mango' ] + for (i=0; i Date: Mon, 8 Jun 2020 16:38:45 -0400 Subject: [PATCH 5/5] finished mvp --- index.js | 132 ++++++++++++++++++++----------------------------------- 1 file changed, 47 insertions(+), 85 deletions(-) diff --git a/index.js b/index.js index 1d3a6ddc7..318521c64 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,7 @@ function addNumbers(num1, num2) { return num1 + num2; } addNumbers(7,5); +console.log(addNumbers(7,5)); @@ -57,6 +58,7 @@ function temperatureCtoF(celsius) { return Math.round(farenheit) ; } temperatureCtoF(24); +console.log(temperatureCtoF(24)); /** * ### Challenge `temperatureInF` * @@ -135,8 +137,8 @@ console.log(getName()); /** * ### Challenge `appleIndex` * - * @instructions - * This function takes as its only argument an array + *@instructions + This function takes as its only argument an array * containing strings, * and returns the index in the array of the string 'apple'. * @@ -147,17 +149,15 @@ console.log(getName()); * passing in 'orange', 'grape', 'apple', 'banana', 'mango' ] as the argument, * the returned value should be: 2.[ */ -function appleIndex() { - let fruit =[`orange`, `grape`,`apple`, `bananan`, `mango`] - return(fruit.indexOf(`apple`)) -} -function appleIndex() { + +function appleIndex(cb) { let fruit =[`orange`, `grape`,`apple`, `banana`, `mango`] - return(fruit.indexOf(`apple`)) + return fruit.indexOf (cb) } -console.log(fruit[2]); -/** +appleIndex(`apple`); +console.log(appleIndex(`apple`)); +/* * ### Challenge `isItAnApple` * * @instructions @@ -172,16 +172,21 @@ console.log(fruit[2]); * passing in [ 'orange', 'apple', 'banana', 'apples', 'apple', 'mango' ] as the argument, * the returned value should be: [ false, true, false, false, true, false ]. */ -function isItAnApple(array) { - const fruit2 = [ 'orange', 'apple', 'banana', 'apples', 'apple', 'mango' ] - for (i=0; i { + if (fruit === "apple") { + fruit2.push(true); + } else { + fruit2.push(false); + } + }); + return fruit2; } +isItAnApple(["orange", "apple", "banana", "apples", "apple", "mango"]); +console.log(isItAnApple(["orange", "apple", "banana", "apples", "apple", "mango"])); + @@ -219,7 +224,7 @@ var inventory = [ // 👇 COMPLETE YOUR WORK BELOW 👇 -/** +/* * ### Challenge `getCarInfoByIndex` * * @instructions @@ -230,16 +235,20 @@ var inventory = [ * * For example, if getCarInfoByIndex is invoked with the inventory and the number 0, * it will return `This is a Lincoln Navigator`. +*/ -*/ function getCarInfoByIndex(inventory, index) { - console.log(`This is a ${car-make}${car_model}`); + const whatCar = inventory[index]; + console.log(`This is a ${whatCar.car_make} ${whatCar.car_model}`); + return(`This is a ${whatCar.car_make}${whatCar.car_model}`); } -getCarInfoByIndex(inventory, index); +getCarInfoByIndex(inventory, 3); -/** + + +/* * ### Challenge `getLastCarInfo` * * @instructions @@ -250,16 +259,13 @@ getCarInfoByIndex(inventory, index); * For example, if getLastCarInfo is invoked passing the inventory inside /data/inventory.js, * it will return `This is a Lincoln Town Car`. */ -function getLastCarInfo(/* code here */) { - /* code here */ -}function getModelYears(arr) { - let cars_year=[]; - /* code here */ - for(let i=0; i