London | 25-ITP-September | Ammad Ur Rehman | Sprint 2 | 03 Complete Sprint 2 Coursework#786
Closed
anosidium wants to merge 12 commits intoCodeYourFuture:mainfrom
Closed
London | 25-ITP-September | Ammad Ur Rehman | Sprint 2 | 03 Complete Sprint 2 Coursework#786anosidium wants to merge 12 commits intoCodeYourFuture:mainfrom
anosidium wants to merge 12 commits intoCodeYourFuture:mainfrom
Conversation
cjyuan
reviewed
Oct 25, 2025
| // c) What is the return value of pad is called for the first time? | ||
| // =============> write your answer here | ||
|
|
||
| // 00 |
Contributor
There was a problem hiding this comment.
A common convention for indicating that a value is a string is to enclose it in double quotes. For example, "00".
| if (hours > 12) { | ||
| return `${hours - 12}:00 pm`; | ||
| let hours = Number(time.slice(0, 2)); | ||
| const minutes = time.slice(3, 5); |
Contributor
There was a problem hiding this comment.
We can also extract the last two characters as time.slice(-2).
cjyuan
reviewed
Oct 28, 2025
Contributor
cjyuan
left a comment
There was a problem hiding this comment.
Changes look great! Well done.
|
|
||
| return result; | ||
| } No newline at end of file | ||
| return String(string).toUpperCase().replaceAll(" ", "_"); |
Contributor
There was a problem hiding this comment.
If string is already a string, we don't have to convert it to a string before using the string methods.
Author
There was a problem hiding this comment.
That's true but it didn't show up in the auto-complete, also given that JavaScript is a dynamically typed language without type safety, the parameter is any type, so I need to ensure that I am dealing with a String type otherwise it fails.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Learners, PR Template
Self checklist
Changelist
I completed all the exercises.
Questions
I understand why TypeScript exists. JavaScript should have been a statically typed language.