-
-
Notifications
You must be signed in to change notification settings - Fork 260
Glasgow | 25-ITP-Sep | Abraham-Habte | Sprint 2 | Coursework/sprint-2 #809
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
Changes from 1 commit
53f9188
a825bf7
d873260
872131a
d139163
14f6ab7
3ea986c
7688edc
a00d344
d336e24
5b0207b
73b25cc
3c5555c
920fa0f
eb5face
f3f4e0b
8448e94
76ab3c7
644248f
ae53e31
f4a96ca
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 |
|---|---|---|
|
|
@@ -15,8 +15,8 @@ | |
| // Use the MDN string documentation to help you find a solution | ||
| // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase | ||
| function toUpperCase(text) { | ||
| return text.toUpperCase(); | ||
| return text.replace(" ", "_").toUpperCase(); | ||
| } | ||
|
|
||
| console.log(toUpperCase("hello there")); | ||
| console.log(toUpperCase("lord of the ring")); | ||
|
||
| console.log(toUpperCase("lord_of_the_ring")); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,12 @@ | |
|
|
||
| // You should call this function a number of times to check it works for different inputs | ||
| function toPounds(pennies) { | ||
|
Contributor
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. The parameter value is expected to be a string in the form "399p" (a sting with a trailing 'p'). |
||
| const pounds = pennies / 100; | ||
| const pounds = (parseInt(pennies.replace("p", ""), 10)) / 100; | ||
| return pounds.toFixed(2); | ||
| } | ||
|
|
||
| // calling the function to make sure it works | ||
| console.log(toPounds(32391)); | ||
| console.log(toPounds(3239)); | ||
| console.log(toPounds(323)); | ||
| console.log(toPounds(32)); | ||
| console.log(toPounds(3)); | ||
| console.log(toPounds("32391p")); | ||
| console.log(toPounds("3239p")); | ||
| console.log(toPounds("323p")); | ||
| console.log(toPounds("32p")); | ||
| console.log(toPounds("3p")); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,19 +4,13 @@ | |
|
|
||
| function formatAs12HourClock(time) { | ||
| const hours = Number(time.slice(0, 2)); | ||
| if (hours===0) { | ||
| return`12:00 am` | ||
| } | ||
| if (hours===12) { | ||
| return `12:00 pm` | ||
| } | ||
| if (hours > 12) { | ||
| return `${hours - 12}:00 pm`; | ||
| } | ||
| if (hours > 0 && hours < 12) | ||
| return `${String(hours).padStart(2, "0")}:00 am`; | ||
| const minutes = time.slice(3, 5); | ||
|
||
| const ampm = hours >= 12 ? "pm" : "am"; | ||
| const Hour = String(hours % 12 === 0 ? 12 : hours % 12).padStart(2, "0") | ||
|
||
| return `${Hour}:${minutes} ${ampm}`; | ||
| } | ||
|
|
||
|
|
||
| const currentOutput = formatAs12HourClock("08:00"); | ||
| const targetOutput = "08:00 am"; | ||
| console.assert( | ||
|
|
||
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.
Why changed
strtofirstLetters?