generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac4dc6c
commit 6e6ede5
Showing
16 changed files
with
153 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,10 +1,8 @@ | ||
|
||
// Predict and explain first... | ||
// this function should square any number but instead we're going to get an error | ||
// what is happening? How can we fix it? | ||
|
||
function square(3) { | ||
return num * num; | ||
// to obtain the first square number we need multiply a number by it self | ||
function square(num) { | ||
return num * num; | ||
} | ||
|
||
|
||
console.log(square(2)); |
This file contains 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 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 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 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,10 +1,21 @@ | ||
// When selling goods, most are subject to the 20% standard rate of VAT. | ||
// You must add 20% to the price you charge for the goods. | ||
// You can do this by multiplying the price you charge by 1.2. | ||
// For example, if your business sells sports equipment for £50, you multiply £50 by 1.2 for a total VAT inclusive price of £60. | ||
// For example, if your business sells sports equipment for £50, you multiply £50 by 1.2 for .. | ||
//..a total VAT inclusive price of £60. | ||
|
||
// Implement a function that calculates the new price with VAT (Value Added Tax) added on. | ||
|
||
// Given a number, | ||
// When I call this function with a number | ||
// Then it returns the new price with VAT added on | ||
function productCostWithVat(price) { | ||
if (typeof price === "number") { | ||
const vatPrice = price * 1.2; | ||
return `£${vatPrice.toFixed(2)}`; | ||
} else { | ||
return "don't waste my time"; | ||
} | ||
} | ||
var price = 399; | ||
console.log(productCostWithVat(price)); |
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//n this project you'll write a script that validates whether or not a credit card number is valid. | ||
|
||
//Here are the rules for a valid number: | ||
|
||
//- Number must be 16 digits, all of them must be numbers. | ||
//- You must have at least two different digits represented (all of the digits cannot be the same). | ||
//- The final digit must be even. | ||
//- The sum of all the digits must be greater than 16. | ||
function creditCardValidator(cardNumber) { | ||
if (typeof cardNumber !== "number" && cardNumber.length !== 16); | ||
{ | ||
return "not card"; | ||
} | ||
} |