generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Open
Abrsh100
wants to merge
20
commits into
CodeYourFuture:main
Choose a base branch
from
Abrsh100: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 all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
53f9188
new work space in vscode
Abrsh100 a825bf7
correctin and updating the exercise
Abrsh100 d873260
Answering each question with in the file by puting // to separate fro…
Abrsh100 872131a
solution for sprint 2
Abrsh100 d139163
Delete Sprint-1/1-key-exercises/1-count.js
Abrsh100 14f6ab7
Delete Sprint-1/1-key-exercises/2-initials.js
Abrsh100 3ea986c
Delete Sprint-1/1-key-exercises/3-paths.js
Abrsh100 7688edc
Delete Sprint-1/2-mandatory-errors/0.js
Abrsh100 a00d344
Delete Sprint-1/1-key-exercises/4-random.js
Abrsh100 d336e24
Delete Sprint-1/2-mandatory-errors/1.js
Abrsh100 5b0207b
Delete Sprint-1/2-mandatory-errors/2.js
Abrsh100 73b25cc
Delete Sprint-1/2-mandatory-errors/3.js
Abrsh100 3c5555c
Delete Sprint-1/3-mandatory-interpret/1-percentage-change.js
Abrsh100 920fa0f
Delete Sprint-1/2-mandatory-errors/4.js
Abrsh100 eb5face
Delete Sprint-1/3-mandatory-interpret/2-time-format.js
Abrsh100 f3f4e0b
Delete Sprint-1/3-mandatory-interpret/3-to-pounds.js
Abrsh100 8448e94
restor sprint 1 from cyf main
Abrsh100 76ab3c7
correcting the errors based on your valuable comments
Abrsh100 644248f
communicating the valuable comments
Abrsh100 ae53e31
changing firstLetter with str
Abrsh100 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
Some comments aren't visible on the classic Files Changed page.
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,13 +1,27 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
|
|
||
| // The code will capitalize the first word of the str which gives "Str" | ||
|
|
||
| // 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; | ||
| } | ||
| // The error occurs in line 13 and it says "SyntaxError: Identifier 'str' has already been declared" | ||
| // The error is informing us that the string str has already been declared in line 12 so we can not declare it again. | ||
|
|
||
| //function capitalise(str) { | ||
| // let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| // return str; | ||
| //} | ||
|
|
||
| // =============> write your explanation here | ||
|
|
||
| // The code is written to capitalize the first letter of str which is expected to give the result Str. | ||
|
|
||
| // =============> write your new code here | ||
|
|
||
| function capitalise(str) { | ||
| str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| return str; | ||
| } | ||
| console.log(capitalise("str")) | ||
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,14 +1,21 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // =============> write your prediction here | ||
| /*the function doesn't return any thing so there will be an error. */ | ||
|
|
||
| function multiply(a, b) { | ||
| /*function multiply(a, b) { | ||
| console.log(a * b); | ||
| } | ||
|
|
||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);*/ | ||
|
|
||
| // =============> write your explanation here | ||
| /* As predicted the function does not return any thing. But the first call gives 320. and the second undefine. */ | ||
|
|
||
| // 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,20 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| /* The code will give us the sum of 10 and 32 which will be " The sum of 10 and 32 is 42" */ | ||
|
|
||
| function sum(a, b) { | ||
| /*function sum(a, b) { | ||
| return; | ||
| a + b; | ||
| } | ||
|
|
||
| console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
| console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);*/ | ||
|
|
||
| // =============> write your explanation here | ||
| /* the call of the function gives undefine result. the reason for this is the semicolon after return which shouldn't be placed there. | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| // =============> write your new code here */ | ||
| function sum(a, b) { | ||
| return a + b; | ||
| } | ||
|
|
||
| console.log(`The sum of 10 and 32 is ${sum(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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,13 @@ | |
| // You will need to declare a function called toPounds with an appropriately named parameter. | ||
|
|
||
| // You should call this function a number of times to check it works for different inputs | ||
| function toPounds(pennies) { | ||
|
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 = (parseInt(pennies.replace("p", ""), 10)) / 100; | ||
| return pounds.toFixed(2); | ||
| } | ||
| // calling the function to make sure it works | ||
| console.log(toPounds("32391p")); | ||
| console.log(toPounds("3239p")); | ||
| console.log(toPounds("323p")); | ||
| console.log(toPounds("32p")); | ||
| console.log(toPounds("3p")); | ||
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
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.
Calling
stra "string" isn’t quite right. Try using a term that describes it as a name rather than a value.Accurate terminology is essential for clear communication and precise reasoning about how code works.