generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 301
London | Nadarajah Sripathmanathan | Module-Structuring-and-Testing-Data | Week 3 #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,12 @@ | ||
| function getAngleType(angle) { | ||
| if (angle === 90) return "Right angle"; | ||
| // replace with your completed function from key-implement | ||
|
|
||
| if (angle < 90 && angle > 0) return "Acute angle"; | ||
| if (angle > 90 && angle < 180) return "Obtuse angle"; | ||
| if (angle === 180) return "Straight angle"; | ||
| if (angle > 180 && angle < 360) return "Reflex angle"; | ||
| if (angle === 0) return "Zero angle"; | ||
| if (angle === 360) return "Full angle"; | ||
| return "Invalid angle"; | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| // Don't get bogged down in this detail | ||
| // Jest uses CommonJS module syntax by default as it's quite old | ||
| // We will upgrade our approach to ES6 modules in the next course module, so for now | ||
| // we have just written the CommonJS module.exports syntax for you | ||
| module.exports = getAngleType; |
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,6 +1,12 @@ | ||
| function isProperFraction(numerator, denominator) { | ||
| if (numerator < denominator) return true; | ||
| // add your completed function from key-implement here | ||
| if (denominator === 0) { | ||
| return false; | ||
| } | ||
| if (Math.abs(numerator) < Math.abs(denominator)) { | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| module.exports = isProperFraction; |
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,5 +1,22 @@ | ||
| function getCardValue(card) { | ||
| // replace with your code from key-implement | ||
| return 11; | ||
| } | ||
| module.exports = getCardValue; | ||
| if (typeof card !== 'string' || card.length < 1) { | ||
| return 0; // Or throw an error, depending on desired behavior for invalid cards. | ||
| } | ||
|
|
||
| const value = card[0]; | ||
|
|
||
| if (value === 'A') { | ||
| return 11; | ||
| } else if (['J', 'Q', 'K'].includes(value)) { | ||
| return 10; | ||
| } else if (['2', '3', '4', '5', '6', '7', '8', '9', '10'].includes(value)) { | ||
| if(value === '1' && card[1] === '0'){ | ||
| return 10; | ||
| } | ||
| return parseInt(value); | ||
| } else { | ||
| return 0; // Or throw an error, depending on desired behavior for invalid cards. | ||
| } | ||
| } | ||
|
|
||
| module.exports = getCardValue; |
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,5 +1,11 @@ | ||
| function countChar(stringOfCharacters, findCharacter) { | ||
| return 5 | ||
| } | ||
|
|
||
| module.exports = countChar; | ||
| const countChar = (str, char) => { | ||
| let count = 0; | ||
| for (let i = 0; i < str.length; i++) { | ||
| if (str[i] === char) { | ||
| count++; | ||
| } | ||
| } | ||
| return count; | ||
| }; | ||
|
|
||
| module.exports = countChar; |
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
Oops, something went wrong.
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.
You can put J,Q,K in same if check