generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 238
Glasgow | 25-ITP-SEP | Mohammed Abdoon | Sprint 2 | Coursework #725
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
Open
M-Abdoon
wants to merge
14
commits into
CodeYourFuture:main
Choose a base branch
from
M-Abdoon:coursework/sprint-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6959f9a
[200~Variable declared twice fixed
M-Abdoon 8472bf4
exercise 1.2 done
M-Abdoon 80d9aff
1-key-errors Done
M-Abdoon 4ccd588
2-mandatory-debug Done
M-Abdoon a6c691a
3-mandatory-implement Done
M-Abdoon 3edc12c
4-mandatory-interpret Done
M-Abdoon c8fe831
Format-time exercise Done
M-Abdoon be15364
minutes recognition added, exercice 5 Done
M-Abdoon 5b3cd1e
Exercise 5 done
M-Abdoon f3c3be7
Changed name of function calculateBmi and var bmi to camelCase
M-Abdoon fa69127
the 00 output will be a string not a number so it is
M-Abdoon eb8e26b
fixed a bug in the function, should return 12:37. and should return
M-Abdoon f4b2947
Set the variable hours as a number then converted it into a string wh…
M-Abdoon 3d1b3c8
updated wrong if confition
M-Abdoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
.DS_Store | ||
.vscode | ||
testing.js --- IGNORE --- | ||
**/.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
// Predict and explain first... | ||
// =============> write your prediction here | ||
// The code has a function that is supposed to capitalise the string passed to it. (only the first letter) | ||
// the string will be stored in the variable str and the function will return its value. | ||
// it takes the first letter (str[0]) and uses toUpperCase() method to capitalise it. | ||
// the str.slice(1) method is used to show the letter. | ||
// | ||
|
||
// call the function capitalise with a string input | ||
// interpret the error message and figure out why an error is occurring | ||
|
||
function capitalise(str) { | ||
let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
return str; | ||
} | ||
|
||
// =============> write your explanation here | ||
// an error occured because the variable str was already declared as a parameter of the function so | ||
// there was no need to use let again. | ||
|
||
|
||
// =============> write your new code here | ||
function capitalise(str) { | ||
str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
return str; | ||
} | ||
|
||
console.log(capitalise("hello")); |
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function formatAs12HourClock(time) { | ||
if (Number(time.slice(0, 2)) > 12) | ||
{ | ||
return `${Number(time.slice(0, 2) - 12)}:00 pm`; | ||
} | ||
return `${time} am`; | ||
} | ||
|
||
let targetOutPut = "2:00 pm"; | ||
let currentOutPut= formatAs12HourClock("14:00"); | ||
|
||
console.assert( | ||
targetOutPut === currentOutPut, | ||
`current output: ${currentOutPut}, target output: ${targetOutPut}` | ||
); | ||
// ========= | ||
targetOutPut = "11:00 am"; | ||
currentOutPut= formatAs12HourClock("11:00"); | ||
|
||
console.assert( | ||
currentOutPut === targetOutPut, | ||
`Error,, current is ${currentOutPut} and target is ${targetOutPut}` | ||
); |
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.
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.
On lines 10-11: Mixing numbers and strings can be dangerous.
A better approach could be:
hours
to a number once at the beginning.padStart()
once to formathours
as a 2-digit string.