-
-
Notifications
You must be signed in to change notification settings - Fork 546
London | 26-ITP-Sep | Yonatan Teklemariam Weldeslassie | Sprint 3 | Coursework #1487
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
Yonatanteklemariam
wants to merge
8
commits into
CodeYourFuture:main
Choose a base branch
from
Yonatanteklemariam:coursework/sprint-3
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 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5dcb8b5
completed the key-errors tasks
Yonatanteklemariam 95ce71d
completed the format-time.js stretch task
Yonatanteklemariam 2ec33a8
answered the questions for time-format.js
Yonatanteklemariam 063ef21
completed and corrected the incorrect codes in mandatory-debug course…
Yonatanteklemariam c5bd231
completed tasks on manadatory-implement
Yonatanteklemariam 2b56c83
implemented to-pound.js function and tested against different checks
Yonatanteklemariam b33ee89
Merge branch 'CodeYourFuture:main' into coursework/sprint-3
Yonatanteklemariam 29fa555
Fix formatting of minutes and stored in a const variable to be reused…
Yonatanteklemariam 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
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 |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
|
|
||
| // Predict and explain first BEFORE you run any code... | ||
|
|
||
| // it will throw a syntax error because we are trying to put a number in the parameter of the function where it should be only a variable name. | ||
| // this function should square any number but instead we're going to get an error | ||
|
|
||
| // =============> write your prediction of the error here | ||
|
|
||
| // this error will occur because a number is being used as a parameter name in the function definition, which is not allowed in JavaScript. Parameter names must be valid variable names, and numbers cannot be used as variable names. Therefore, the code will throw a syntax error when it is run. Another error is that the variable num is not defined in the function, so it will throw a reference error when trying to return num * num. | ||
| function square(3) { | ||
| return num * num; | ||
| } | ||
|
|
||
| // =============> write the error message here | ||
|
|
||
| // Uncaught SyntaxError: Illegal return statement | ||
| // Uncaught SyntaxError: Unexpected number | ||
| // =============> explain this error message here | ||
|
|
||
| // This error message indicates that there is a syntax error in the code that entails both an illegal return statement and an unexpected number. The illegal return statement error occurs because the function is trying to return a value from a function that is not properly defined. The unexpected number error occurs because the parameter name of the function is a number, which is not allowed in JavaScript. | ||
| // Finally, correct the code to fix the problem | ||
|
|
||
| // =============> write your new code here | ||
| /* | ||
| function square(num) { | ||
| return num * num; | ||
| } | ||
| */ | ||
|
|
||
|
|
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,14 +1,19 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // =============> write your prediction here | ||
|
|
||
| // as we are not returning anything from the function, it is not possible to retrieve the returned value from this function, so it will throw undefined. | ||
| function multiply(a, b) { | ||
| console.log(a * b); | ||
| } | ||
|
|
||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
|
|
||
| // =============> write your explanation here | ||
|
|
||
| // however when the function is run, it displays 320 and undefined next to the The result of multiplying 10 and 32. So obviusly the 320 is displayed on the console, because that's the output of the function, but it is undefined when we try to retrieve it for use in the template literals. so we need to return the value inside a function in order to use it outside. | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function multiply(a, b) { | ||
| return a * b; | ||
| } | ||
|
|
||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); |
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
Oops, something went wrong.
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.
Notice how the formatting in the template string for the minutes part is the same each time? Could this be simplified so the formatting is only done in one place?
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.
Hi Lon, Thanks for your feedback, I actually corrected the formatting accordingly. I would appreciate if you could look at it and put your review, thanks.