This repository was archived by the owner on Jan 14, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 265
London9 Lovelace - Oleksii Chepurnyi - JavaScript Core 2 Coursework - Week1 #184
Open
OleksChep
wants to merge
9
commits into
CodeYourFuture:main
Choose a base branch
from
OleksChep:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e493be7
A exercises done
OleksChep 5f70dd8
A ex. done finally
OleksChep e2de0d0
B-setting-values exercises 1 and 2 done.js /
OleksChep b342d70
C exercise done
OleksChep 76747ed
1-exercises A,B,C,D done
OleksChep f5303d1
Update 1-recipes.js
OleksChep b867a24
Completed 2-currency-code-lookup
OleksChep f9f3b1b
Mandatory done
OleksChep 1450e48
Extra task done
OleksChep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,26 +13,25 @@ let car = { | |
| brand: "Ford", | ||
| yearsOld: 8, | ||
| }; | ||
|
|
||
| console.log(car["colour"]); | ||
| // In object car there is no property - "colour" | ||
|
|
||
| // Example 2 | ||
| function sayHelloToUser(user) { | ||
| console.log(`Hello ${user.firstName}`); | ||
| } | ||
|
|
||
| let user = { | ||
| name: "Mira" | ||
| }; | ||
|
|
||
| sayHelloToUser(user); | ||
| // the property of object is only one and called "name", not "firstName" | ||
|
|
||
| // Example 3 | ||
| let myPet = { | ||
| animal: "Cat", | ||
| getName: function() { | ||
| "My pet's name is Fluffy"; | ||
| "My pet's name is Fluffy"; | ||
| }, | ||
| }; | ||
|
|
||
| console.log(myPet.getName()); | ||
| // the getName is not a function , getName is property of object myPet | ||
|
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. That's not correct: getName is a function, and |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,4 +22,68 @@ | |
| You should write and log at least 5 recipes | ||
| */ | ||
|
|
||
| // write code here | ||
| // write code here | ||
| console.log("\ ") | ||
| // Recipe 1 Borshch | ||
| let recipe1 = { | ||
| title: "Borsch", | ||
| servings: 75, | ||
| ingredients: [ | ||
| "Cabbage -5kg", | ||
| "Potato -5kg", | ||
| "Carrot -3kg", | ||
| "Onion -1kg", | ||
| "Beetroot -1kg", | ||
| "Bean-2kg", | ||
| "Tomatoes-2kg", | ||
| "Vegetable oil - 200g", | ||
| ] | ||
| }; | ||
| console.log("Recipe 1", " ", recipe1.title); | ||
| console.log("Servings: ", recipe1.servings); | ||
| console.log("Ingredients:", "\n", recipe1.ingredients.join("\n")); | ||
| console.log(`\ `); | ||
|
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. I'm not sure that line is necessary 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. or perhaps you meant |
||
|
|
||
| // Recipe 2 Pasta | ||
| let recipe2 = { | ||
| title: "Pasta", | ||
| servings: 2, | ||
| ingredients: ["Pasta -300g", "Butter -20g","Water -1000g"] | ||
| }; | ||
| console.log("Recipe 2", " ", recipe2.title); | ||
| console.log("Servings: ", recipe2.servings); | ||
| console.log("Ingredients:", "\n", recipe2.ingredients.join("\n")); | ||
| console.log(`\ `); | ||
|
|
||
| // Recipe 3 Cake Kyiv | ||
| let recipe3 = { | ||
| title: "Cake Kyiv", | ||
| servings: 5, | ||
| ingredients: ["Nuts-100g", "Eggs-3", "Butter-20g", "Flour-500g", "Sugar-10g", "Milk-200g"], | ||
| }; | ||
| console.log("Recipe 3", " ", recipe3.title); | ||
| console.log("Servings: ",recipe3.servings); | ||
| console.log("Ingredients:", "\n", recipe3.ingredients.join("\n")); | ||
| console.log(`\ `); | ||
|
|
||
| // Recipe 4 Potato | ||
| let recipe4 = { | ||
| title: "Potato", | ||
| servings: 15, | ||
| ingredients: ["Potato -5kg", "Butter -500g", "Water -10l"] | ||
| }; | ||
| console.log("Recipe 4", " ", recipe4.title); | ||
| console.log("Servings: ", recipe4.servings); | ||
| console.log("Ingredients:", "\n", recipe4.ingredients.join("\n")); | ||
| console.log(`\ `); | ||
|
|
||
| // Recipe 5 | ||
| let recipe5 = { | ||
| title: "Latte", | ||
| servings: 75, | ||
| ingredients: ["Coffee -10kg", "Milk -5kg", "Water -10l"] | ||
| }; | ||
| console.log("Recipe 5", " ", recipe5.title); | ||
| console.log("Servings: ", recipe5.servings); | ||
| console.log("Ingredients:", "\n", recipe5.ingredients.join("\n")); | ||
| console.log(`\ `); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Good idea to use a variable to make your code more readable