-
-
Notifications
You must be signed in to change notification settings - Fork 398
London | ITP-may-2026 | Hugh Mills | Sprint 2 | Sprint 2 Coursework #1515
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
215f710
43314e7
bc09e54
3860339
16cb295
26932f6
b337899
7fe8f43
120157a
d79d235
442d795
2c21e1b
710cd97
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 |
|---|---|---|
|
|
@@ -14,3 +14,11 @@ | |
| // You will need to come up with an appropriate name for the function | ||
| // 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 UpperSnake(text) { | ||
| let upperCase = text.toUpperCase(); | ||
| let snakeCase = upperCase.replaceAll(" ","_"); | ||
| return snakeCase; | ||
| } | ||
|
Comment on lines
+18
to
+22
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. Code is correct. Can you look up the naming conventions in JavaScript? In particular,
Then, update the function names according to those conventions.
Author
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. Not to sure what you mean with this one?
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. What's best practice to name a function in JavaScript?
Author
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 name should describe clearly what the function is doing.
Author
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. so I should have named it more like upperCase => makeUpperCase and snakeCase => makeSnakeCase ?
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. Yes. A |
||
|
|
||
| console.log(UpperSnake("hello there bob")); | ||
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 would you make the function to work for any valid argument?
For example, calling
convertToPercentage(0.1)would return"10%".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.
Like this?
function convertToPercentage(decimalNumber) {
return percentage =
${decimalNumber * 100}%;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.
Correct.
Do lookup Markdown syntax for embedding code.