Repository navigation
London | 26-ITP-Sept | Fung Nin Lee | Sprint 2 | practice-tdd #1708
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
Open
leerogerfn
wants to merge
21
commits into
CodeYourFuture:main
Choose a base branch
from
leerogerfn:coursework/sprint-3-practice-tdd
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
21 commits
Select commit
Hold shift + click to select a range
e257518
intialise test for 0 occurrences character
leerogerfn eff24ad
written function for count.js
leerogerfn 99fac63
written test for get-ordinal-number-test.js
leerogerfn f639c2f
written function for get-ordinal-number-test.js
leerogerfn 3286ffc
written function for get-ordinal-number-test.js
leerogerfn 490bddb
completed to write the tes for repeat-str.test
leerogerfn f77cde9
drafting the function of repeatStr.
leerogerfn 83f7ae8
formatted document for count.js
leerogerfn 92f3f60
written test for repeat-str.test.js
leerogerfn 9a9f0f8
formatted document for repeat-str.js
leerogerfn dcee7f9
remove console.log in repeat-str.js
leerogerfn b4b909e
added test for char only exist in part of str for count.test.js
leerogerfn fc9bc09
added no occurrences in str with different char
leerogerfn 5bcc595
change the wording on description of test.
leerogerfn 1325473
added 111, 112, 113 for get-ordinal-number.test.js
leerogerfn 051fef8
added "goodbye" to repeat-str.test.js
leerogerfn e18e1dc
added more test cases for "goodbye"
leerogerfn 1a4e9e0
revised the function of get-ordinal-number.js
leerogerfn 11f50bb
added empty string for count.test.js
leerogerfn f0b41af
revised test for 111, 112, 113 get-ordinal-number.test.js
leerogerfn c7be983
added empty str for get-ordinal-number.test.js
leerogerfn 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
Some comments aren't visible on the classic Files Changed page.
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,3 +1,9 @@ | ||
| export function countChar(stringOfCharacters, findCharacter) { | ||
| return 5 | ||
| let count = 0; | ||
| for (let i = 0; i < stringOfCharacters.length; i++) { | ||
| if (stringOfCharacters[i] === findCharacter) { | ||
| count++; | ||
| } | ||
| } | ||
| return count; | ||
| } |
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,18 @@ | ||
| export function getOrdinalNumber(num) { | ||
| return "1st"; | ||
| const numToString = num.toString(); | ||
|
|
||
| if ( | ||
| numToString.slice(-2) === "11" || | ||
| numToString.slice(-2) === "12" || | ||
| numToString.slice(-2) === "13" | ||
| ) { | ||
| return `${num}th`; | ||
| } else if (numToString.at(-1) === "1") { | ||
| return `${num}st`; | ||
| } else if (numToString.at(-1) === "2") { | ||
| return `${num}nd`; | ||
| } else if (numToString.at(-1) === "3") { | ||
| return `${num}rd`; | ||
| } | ||
| return `${num}th`; | ||
| } |
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.
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.
how about a larger number like
111?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.
111should be111thbut not111st. Similar to112thand113th. Please fix them, thank you.