-
-
Notifications
You must be signed in to change notification settings - Fork 195
WM | May-2025 | Abdullah Saleh | Sprint-3 #627
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
base: main
Are you sure you want to change the base?
Changes from all commits
47b1a74
c9e25de
ff1cbee
bd578be
9ff46f5
a73f361
06e2a86
a6f7736
5753049
df3199e
a6058f7
b932013
de840d7
10e1c6f
f24f108
8305998
aa39192
92f2da6
f603a66
b7a90c5
134b91c
4e1421a
0245190
783be9e
87e59b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
function isProperFraction(numerator, denominator) { | ||
if (numerator < denominator) return true; | ||
// add your completed function from key-implement here | ||
return Math.abs(numerator) < Math.abs(denominator) | ||
} | ||
|
||
module.exports = isProperFraction; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
function getCardValue(card) { | ||
// replace with your code from key-implement | ||
return 11; | ||
let rank = card.slice(0, -1); | ||
if (rank === "A" || rank === "Ace") return 11; | ||
else if (rank >= 2 && rank <= 9) return Number(rank); | ||
else if (rank === 10 || rank === "J" || rank === "Q" || rank === "K") return 10; | ||
else return "Invalid card rank." | ||
} | ||
module.exports = getCardValue; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
function countChar(stringOfCharacters, findCharacter) { | ||
return 5 | ||
let charNum = stringOfCharacters.split(findCharacter).length -1; | ||
return charNum | ||
|
||
} | ||
|
||
module.exports = countChar; | ||
|
||
module.exports = countChar; | ||
|
||
|
||
/* pseudocode: | ||
// we need to look for a specific character inside a string | ||
|
||
|
||
|
||
|
||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
function getOrdinalNumber(num) { | ||
return "1st"; | ||
let oneDigit = num % 10; | ||
let twoDigit = num % 100; | ||
if (twoDigit >= 11 && twoDigit <= 13 ) return `${num}th`; | ||
illicitonion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else if (oneDigit == 1) return `${num}st`; | ||
else if (oneDigit == 2) return `${num}nd`; | ||
else if (oneDigit == 3) return `${num}rd`; | ||
else return `${num}th`; | ||
} | ||
|
||
module.exports = getOrdinalNumber; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
function repeat() { | ||
return "hellohellohello"; | ||
function repeat(str, count) { | ||
if (count > 0) return `${str.repeat(count)}`; | ||
else if (count == 0) return ""; | ||
else if (count < 0) return "negative counts are not valid"; | ||
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. What do you think about returning a string here vs throwing an error? With the fraction with denominator of 0 you decided to throw - is there a reason to prefer one or the other here? 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. You're right — there's no strong reason for treating them differently. |
||
} | ||
|
||
module.exports = repeat; | ||
module.exports = repeat; |
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 could have handled 10 in the "If a number" case or the "J/Q/K" case (both of which work). Why did you decide to choose the approach you did? What benefits/drawbacks does each have?
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.
Actually, I handled it that way because I was following the structure of the test cases. I assumed that 10 could be treated as part of the numeric range and added to the first condition, rather than grouping it with the string values like "J", "Q", or "K".