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 Turing -Farnoosh Moayeri-JS-Week-1 #458
Open
Farnooshmo
wants to merge
12
commits into
CodeYourFuture:master
Choose a base branch
from
Farnooshmo: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
12 commits
Select commit
Hold shift + click to select a range
0237352
Update 1-syntax-errors.js
Farnooshmo 951e9a3
Mandatory completed!
Farnooshmo 5161b99
Exercises from A to F-strings- methods completed
Farnooshmo e2d11f5
Exercises/G-numbers completed!
Farnooshmo 01ae4f2
Exercise/I-floats completed!
Farnooshmo 80b7d1c
Exercises/J-function completed!
Farnooshmo 94902df
Exercises/K-function completed!
Farnooshmo 26b29da
Exercises/L-function completed!
Farnooshmo 52eb5cc
Changes after code review
Farnooshmo 51e44ed
extra 1 completed
Farnooshmo 2691d99
Merge branch 'master' of https://github.com/Farnooshmo/JavaScript-Cor…
Farnooshmo 79ad412
Update 2-piping.js
Farnooshmo 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,10 @@ | ||
| console.log("Hello world"); | ||
| let greeting ="HEY!"; | ||
| console.log(greeting); | ||
| console.log("Hi, A newbie at JavaScript!"); | ||
| console.log("Hi, A newbie at JavaScript!"); | ||
| console.log("Hi, A newbie at JavaScript!"); | ||
| console.log("Hi, A newbie at JavaScript!"); | ||
| console.log('Hi, a newbie at JavaACript!'); | ||
| console.log(1); | ||
|
|
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` | ||
|
|
||
| var greeting = `Hello guys! Welcome to JavaScript!`; | ||
| 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
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 `message` | ||
|
|
||
| var message = "Read the instruction"; | ||
| var messageType = typeof message; | ||
| console.log(message); | ||
| console.log(messageType); | ||
| console.log("This is a " + 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
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 message = "Hello, This is Farnoosh!"; | ||
| console.log(message); | ||
| var myName = "Farnoosh"; | ||
| var myNameLenght = myName.length; | ||
| console.log(myNameLenght); | ||
| var messageOne = message + " My name is " + myNameLenght + " characters long!"; | ||
| console.log(messageOne); |
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 `message` | ||
|
|
||
| const message = "Read the instruction!"; | ||
| let messageType = typeof message; | ||
| console.log(message); | ||
| console.log(messageType); | ||
| console.log("This is a " + 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 @@ | ||
| const name = " Daniel "; | ||
| const message = "Hello, This is Farnoosh!"; | ||
| const myName = "Farnoosh"; | ||
| let myNameTrim = myName.trim(); | ||
| let myNameLenght = myName.length; | ||
|
|
||
| console.log(message); | ||
| let messageTwo = message + " My name is " + myNameLenght + " characters long!"; | ||
| console.log(messageTwo); | ||
| console.log(myNameLenght); |
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,14 @@ | ||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
|
|
||
| students = numberOfStudents; | ||
| mentors = numberOfMentors; | ||
|
|
||
| var messageStudent = "Number of students: " + students; | ||
| var MessageMentors = "Number of mentors: " + mentors; | ||
| var totalInClass = students + mentors; | ||
| var messageTotal = "Total number of students and mentors: " + totalInClass; | ||
| console.log(messageStudent); | ||
| console.log(MessageMentors); | ||
| console.log(messageTotal); |
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; | ||
| students = numberOfStudents; | ||
| mentors = numberOfMentors; | ||
|
|
||
| var totalInClass = students + mentors; | ||
| let percentageOfStudent = (students / totalInClass) * 100; | ||
| let percentageOfStudentRound = Math.round(percentageOfStudent); | ||
|
|
||
| console.log("Percentage students: " + percentageOfStudentRound); | ||
|
|
||
| let percentageOfMentorsRound = Math.round((mentors / totalInClass) * 100); | ||
| let messagePercentageOfMentors = | ||
| "Percentage Mentors: " + percentageOfMentorsRound; | ||
| console.log(messagePercentageOfMentors); |
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,8 @@ | ||
| function halve(number) { | ||
| // complete the function here | ||
| return number / 2; | ||
| } | ||
|
|
||
| var result = halve(12); | ||
|
|
||
| console.log(result); | ||
| console.log(halve(82)); |
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,5 +1,5 @@ | ||
| function triple(number) { | ||
| // complete function here | ||
| return number * 3; | ||
| } | ||
|
|
||
| var result = triple(12); | ||
|
|
||
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,9 +1,9 @@ | ||
| // Complete the function so that it takes input parameters | ||
| function multiply() { | ||
| // Calculate the result of the function and return it | ||
| function multiply(a, b) { | ||
| return a * b; | ||
| } | ||
|
|
||
| // Assign the result of calling the function the variable `result` | ||
| var result = multiply(3, 4); | ||
| let result = multiply(3, 4); | ||
|
|
||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| // Declare your function first | ||
| function divide(a, b) { | ||
| return a / b; | ||
| } | ||
|
|
||
| var result = divide(3, 4); | ||
| let result = divide(3, 4); | ||
|
|
||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| // Write your function here | ||
|
|
||
| var greeting = createGreeting("Daniel"); | ||
| function createGreeting(name) { | ||
| const greet = "Hello, my name is "; | ||
|
|
||
| return greet + name; | ||
|
|
||
| } | ||
|
|
||
| let greeting = createGreeting("Daniel"); | ||
| 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,5 +1,7 @@ | ||
| // Declare your function first | ||
| function add(a, b) { | ||
| return a + b; | ||
| } | ||
|
|
||
| // Call the function and assign to a variable `sum` | ||
|
|
||
| var sum = add(13, 124); | ||
| console.log(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
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
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,7 +5,10 @@ | |
| Sales tax is 20% of the price of the product. | ||
| */ | ||
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(priceOfProduct) { | ||
| const salesTax = 0.2 * priceOfProduct; | ||
|
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. Great, well done |
||
| return priceOfProduct + salesTax; | ||
| } | ||
|
|
||
| /* | ||
| CURRENCY FORMATTING | ||
|
|
@@ -17,7 +20,12 @@ function calculateSalesTax() {} | |
| Remember that the prices must include the sales tax (hint: you already wrote a function for this!) | ||
| */ | ||
|
|
||
| function addTaxAndFormatCurrency() {} | ||
| function addTaxAndFormatCurrency(priceOfProduct) { | ||
| const newLocal = calculateSalesTax(priceOfProduct).toFixed(2); | ||
| let vat = newLocal; | ||
| return `£${vat}`; | ||
| } | ||
| console.log(addTaxAndFormatCurrency(17.5)); | ||
|
|
||
| /* | ||
| =================================================== | ||
|
|
@@ -53,3 +61,7 @@ test("addTaxAndFormatCurrency for £17.50", () => { | |
| test("addTaxAndFormatCurrency for £34", () => { | ||
| expect(addTaxAndFormatCurrency(34)).toEqual("£40.80"); | ||
| }); | ||
| function newFunction() { | ||
| console.log(addTaxAndFormatCurrency(15)); | ||
| } | ||
|
|
||
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 use of a string template!