-
-
Notifications
You must be signed in to change notification settings - Fork 195
Sheffield| May 2025| Mayowa Fadare| Structure testing sprint 3 #633
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 6 commits
3b13a90
cd2d9f1
b3bfd4b
eb25c34
52cc4a3
339c2ba
14c036b
c7ccd98
5981bd2
989265d
d465d6a
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,14 @@ | ||
function isProperFraction(numerator, denominator) { | ||
if (numerator < denominator) return true; | ||
// add your completed function from key-implement here | ||
} | ||
if (numerator < denominator) return true;} | ||
if (Math.abs(numerator) < Math.abs(denominator)) { | ||
return true; | ||
} { return false; } | ||
if (numerator < denominator) { | ||
return true; | ||
} if (numerator === denominator) { | ||
return false; | ||
} if (denominator === 0) { | ||
return false; | ||
} | ||
cjyuan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
module.exports = isProperFraction; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,16 @@ function getCardValue(card) { | |
// replace with your code from key-implement | ||
return 11; | ||
} | ||
module.exports = getCardValue; | ||
function getCardValue(card) { | ||
const rank = card.slice(0, -1); // strip off the suit emoji | ||
|
||
if (rank === "A") return 11; | ||
if (["K", "Q", "J", "10"].includes(rank)) return 10; | ||
|
||
const number = parseInt(rank); | ||
if (!isNaN(number) && number >= 2 && number <= 9) { | ||
return number; | ||
} | ||
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. Does your function return the value you expected from each of the following function calls?
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. Have you checked if the above function calls can return the expected value? |
||
|
||
throw new Error("Invalid card rank"); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
function getOrdinalNumber(num) { | ||
return "1st"; | ||
} | ||
function getOrdinalNumber(num) { | ||
const lastDigit = num % 10; | ||
const lastTwoDigits = num % 100; | ||
|
||
if (lastTwoDigits >= 11 && lastTwoDigits <= 13) { | ||
return num + "th"; | ||
} | ||
|
||
switch (lastDigit) { | ||
case 1: | ||
return num + "st"; | ||
case 2: | ||
return num + "nd"; | ||
case 3: | ||
return num + "rd"; | ||
default: | ||
return num + "th"; | ||
} | ||
} | ||
|
||
module.exports = getOrdinalNumber; | ||
module.exports = getOrdinalNumber; |
Uh oh!
There was an error while loading. Please reload this page.