-
-
Notifications
You must be signed in to change notification settings - Fork 267
Glasgow_6 - Ehdaa_Sakawi - JS - Core2- Week1 #264
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,4 +22,15 @@ | |
| You should write and log at least 5 recipes | ||
| */ | ||
|
|
||
| // write code here | ||
| // write code here | ||
| let Recipe = { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is a common javascript coding standard to have variable names that are camel cased : https://www.w3schools.com/js/js_conventions.asp PascalCasing (such as your usage in "Recipe") is normally used for class definitions |
||
| title: "Mole" , //(a string), | ||
| servings: 2 , //a number), and | ||
| ingredients: ["cinnamon", "cumin", "cocoa"] //(an array of strings) | ||
|
|
||
| }; | ||
| console.log(Recipe.title); | ||
| console.log(`Serves: ${Recipe.servings}`); | ||
| console.log(Recipe.ingredients[0]); | ||
| console.log(Recipe.ingredients[1]); | ||
| console.log(Recipe.ingredients[2]); | ||
|
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ how could you change this to handle a variable amount of ingredients without adding any additional lines of code |
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice and concise 👍 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,13 @@ const COUNTRY_CURRENCY_CODES = [ | |
|
|
||
| function createLookup(countryCurrencyCodes) { | ||
| // write code here | ||
|
|
||
| let res = {}; | ||
| for( let [countrycodes, currencycodes] of countryCurrencyCodes){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 nice use of destructuring here |
||
|
|
||
| res[countrycodes] = currencycodes; | ||
| }; | ||
| return res; | ||
| } | ||
|
|
||
| /* ======= TESTS - DO NOT MODIFY ===== | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ have you ran prettier on this code |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,41 +35,65 @@ function convertScoreToGrade(score) { | |
| passes. | ||
| */ | ||
| test("a score of 83 is grade A", () => { | ||
| expect(convertScoreToGrade(83), "Z"); | ||
| expect(convertScoreToGrade(83)).toEqual("A"); | ||
| }); | ||
|
|
||
| /* | ||
| The rest of the tests have comments describing what to test and you need to | ||
| write a matching test | ||
| */ | ||
|
|
||
| test.skip("a score of 71 is grade B", () => { | ||
| test("a score of 71 is grade B", () => { | ||
| expect(convertScoreToGrade(71)).toEqual("B"); | ||
| /* Remove the .skip above, then write the test body. */ | ||
| }); | ||
| /* | ||
| Write a test that checks a score of 68 is grade C | ||
|
|
||
|
|
||
| /* Write a test that checks a score of 68 is grade C | ||
| */ | ||
| test("a score of 68 is grade C", () => { | ||
| expect(convertScoreToGrade(68)).toEqual("C"); | ||
| }); | ||
|
|
||
|
|
||
| /* | ||
| Write a test that checks a score of 55 is grade D | ||
| */ | ||
| test("a score of 55 is grade D", () => { | ||
| expect(convertScoreToGrade(55)).toEqual("D"); | ||
| }); | ||
|
|
||
|
|
||
| /* | ||
| Write a test that checks a score of 68 is grade C | ||
| */ | ||
| test("a score of 68 is grade C", () => { | ||
| expect(convertScoreToGrade(68)).toEqual("C"); | ||
| }); | ||
|
|
||
| /* | ||
| Write a test that checks a score of 55 is grade D | ||
| */ | ||
| test("a score of 68 is grade D", () => { | ||
| expect(convertScoreToGrade(55)).toEqual("D"); | ||
| }); | ||
|
|
||
| /* | ||
| Write a test that checks a score of 49 is grade E | ||
| */ | ||
| test("a score of 68 is grade E", () => { | ||
| expect(convertScoreToGrade(49)).toEqual("E"); | ||
| }); | ||
|
|
||
| /* | ||
| Write a test that checks a score of 30 is grade E | ||
| */ | ||
|
|
||
| test("a score of 68 is grade E", () => { | ||
| expect(convertScoreToGrade(30)).toEqual("E"); | ||
| }); | ||
| /* | ||
| Write a test that checks a score of 70 is grade B | ||
| */ | ||
| test("a score of 68 is grade B", () => { | ||
| expect(convertScoreToGrade(70)).toEqual("B"); | ||
| }); | ||
|
Comment on lines
75
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ Have you checked the names of these tests - it looks like you may have copy and pasted without updating |
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing wrong with your code here - the provided function "convertScoreToGrade" is missing the score parameter here which you will need to add to pass the tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍