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 475
London 9 - Karleen Richards - Javascript - Core 1 - Coursework - Week 1 #451
Open
karleenmsrichards
wants to merge
7
commits into
CodeYourFuture:master
Choose a base branch
from
karleenmsrichards:master
base: master
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
7 commits
Select commit
Hold shift + click to select a range
d364c5e
Did mandatory 1
karleenmsrichards 8a1854e
Finished mandatory 2
karleenmsrichards d2cb1d9
Completed Mandatory 3
karleenmsrichards ef21bd3
Completed Mandatory 4
karleenmsrichards 186bbe6
Completed Extra 1
karleenmsrichards bffd14b
Completed extra 2
karleenmsrichards 0f71dd4
Completed some exercies, I have not completed all yet
karleenmsrichards 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| console.log("Hello world"); | ||
|
|
||
| console.log (12345); | ||
| console.log ("Hello World I just started learning Jvascript"); | ||
|
|
||
|
|
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 |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| // Start by creating a variable `greeting` | ||
| let greeting = "Hello World"; | ||
|
|
||
| console.log (greeting); | ||
| console.log (greeting); | ||
| console.log(greeting); |
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 |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| // Start by creating a variable `message` | ||
| let message = "This is a string in Javascript"; | ||
| let messageType = typeof message; | ||
|
|
||
| console.log(message); | ||
| console.log(messageType); | ||
|
|
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 |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| // Start by creating a variable `message` | ||
| var greetingStart = "Hello, my name is "; | ||
| var name = "Karleen"; | ||
| var greetingEnd = ", I'm glad you visited." | ||
|
|
||
| console.log(message); | ||
| var greeting = greetingStart + name + greetingEnd; | ||
|
|
||
| console.log(greeting); |
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 |
|---|---|---|
| @@ -1,2 +1,15 @@ | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
|
|
||
| const amtOfTrainees = "Number of trainees: "; | ||
| const numberOfTrainees = 36; | ||
|
|
||
| console.log (amtOfTrainees + numberOfTrainees); | ||
|
|
||
| const amtOfMentors = "Number of mentors: "; | ||
| const numberOfMentors = 10; | ||
|
|
||
| console.log (amtOfMentors + numberOfMentors); | ||
|
|
||
| const sum = 36 + 10; | ||
| console.log ("Total number of trainees and mentors: " + sum); |
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 |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| function halve(number) { | ||
| // complete the function here | ||
|
|
||
| function increaseByHalf(number) { | ||
| return number / 2 + number | ||
| } | ||
|
|
||
| var result = halve(12); | ||
| var result = increaseByHalf(400); | ||
| console.log(result); | ||
|
|
||
| var result = increaseByHalf(1000); | ||
| console.log(result); | ||
|
|
||
| var result = increaseByHalf(8500); | ||
| console.log(result); |
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 |
|---|---|---|
|
|
@@ -5,8 +5,13 @@ | |
| Sales tax is 20% of the price of the product. | ||
| */ | ||
|
|
||
| function calculateSalesTax() {} | ||
|
|
||
| function calculateSalesTax(a) { | ||
|
|
||
| return (20 / 100 * a) + a; | ||
| } | ||
| console.log(calculateSalesTax(15)); | ||
| console.log(calculateSalesTax(17.50)); | ||
| console.log(calculateSalesTax(34)); | ||
| /* | ||
| CURRENCY FORMATTING | ||
| =================== | ||
|
|
@@ -17,7 +22,12 @@ function calculateSalesTax() {} | |
| Remember that the prices must include the sales tax (hint: you already wrote a function for this!) | ||
| */ | ||
|
|
||
| function addTaxAndFormatCurrency() {} | ||
| function addTaxAndFormatCurrency(b) { | ||
| return "£" + ((20 / 100 * b) + b).toFixed(2); | ||
| } | ||
|
Comment on lines
+25
to
+27
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. Good use of .toFixed()
Author
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. Hi Pete, I'm not sure if I understand what you mean. Can you please explain this more. Should I change it to b * 1.2? |
||
| console.log(addTaxAndFormatCurrency(15)); | ||
| console.log(addTaxAndFormatCurrency(17.50)); | ||
| console.log(addTaxAndFormatCurrency(34)); | ||
|
|
||
| /* | ||
| =================================================== | ||
|
|
||
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.
Well done on getting onto this!