generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 239
London | 25-ITP-Sep | Payman Issa Baiglu | Sprint 2 | Coursework/sprint 2 #838
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
PaymanIB
wants to merge
22
commits into
CodeYourFuture:main
Choose a base branch
from
PaymanIB: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.
+158
−62
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
2c6aae7
1-key-errors,0.js, completed
876bf7b
Fix variable shadowing in capitalise function and update console log;…
058c055
Fix function definition and error explanations in square function exa…
c8cebbb
Fix multiply function to return value and update
a5bdca3
Fix sum function to return correct value and update console log
7ea670b
Fix getLastDigit function to accept parameter and return correct last…
f5b79bf
Implement BMI calculation function and log result
b760859
Fix console log statement formatting in BMI calculation
1f37466
Implement toUpperSnakeCase function to convert strings to UPPER_SNAKE…
e943a03
Implement toPounds function to convert pence to pounds and log results
5f29b84
Refactor comments and formatting in time-format.js for clarity
8ecd330
Refactor formatAs12HourClock function to improve time validation and …
0e37a64
Update comment to clarify syntax error in capitalise function
cd942b8
updated the answer on line 4.
906778c
Remove redundant comments and clarify the capitalise function impleme…
ed909e1
Fix indentation in commented-out code for clarity in convertToPercent…
d486397
Update comment to clarify explanation of return statement in sum func…
6eb8b88
Remove redundant declaration of decimalNumber in convertToPercentage …
62492e1
Refactor convertToPercentage function to return percentage directly
25347a2
Fix prediction comment in 2.js to accurately reflect expected output
ba8d606
Refactor toPounds function for improved readability and consistency
b185d08
Remove unnecessary comments in formatTimeDisplay function for cleaner…
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
Submodule Project-CLI-Treasure-Hunt
added at
6668c4
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,18 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
|
|
||
| // I gives us a syntax error as str declared before. | ||
| // 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; | ||
| } | ||
| // function capitalise(str) { | ||
| // let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| // return str; | ||
| // } | ||
|
|
||
| // =============> write your explanation here | ||
| // =============> write your explanation here : | ||
| // as the variable in side the function has the same name as the function variable. | ||
| // =============> write your new code here | ||
| function capitalise(str) { | ||
| return `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| } | ||
| console.log(capitalise("abcd")); |
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,30 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // Why will an error occur when this program runs? | ||
| // error on line 11 | ||
| // error on line 17 | ||
| // Why will an error occur when this program runs? yes | ||
| // =============> write your prediction here | ||
| // decimalNumber is declared before and can not be declared again. | ||
| // console.log(decimalNumber) should be console.log(convertToPercentage) | ||
| // Try playing computer with the example to work ot what is going on | ||
|
|
||
| // Try playing computer with the example to work out what is going on | ||
|
|
||
| function convertToPercentage(decimalNumber) { | ||
| const decimalNumber = 0.5; | ||
| const percentage = `${decimalNumber * 100}%`; | ||
| // function convertToPercentage(decimalNumber) { | ||
| // const decimalNumber = 0.5; | ||
| // const percentage = `${decimalNumber * 100}%`; | ||
|
|
||
| return percentage; | ||
| } | ||
| // return percentage; | ||
| // } | ||
|
|
||
| console.log(decimalNumber); | ||
| //console.log(percentage); | ||
|
|
||
| // =============> write your explanation here | ||
| // decimalNumber is declared before and can not be declared again. | ||
| // console.log(decimalNumber) should be console.log(convertToPercentage) | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function convertToPercentage(decimalNumber) { | ||
| return `${decimalNumber * 100}%`; | ||
|
|
||
| } | ||
|
|
||
| console.log(convertToPercentage(0.5)); | ||
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,20 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // =============> write your prediction here | ||
| // it looks fine. | ||
|
|
||
| function multiply(a, b) { | ||
| console.log(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 | ||
|
|
||
| // It misses the return value of multiply function. | ||
| // 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,19 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| // there is an error on line 5 and 6 | ||
| //function sum(a, b) { | ||
| // //return; | ||
| // 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 return statement is not returning any value. a+b mentioned after return. | ||
| // Finally, correct the code to fix the problem | ||
| // =============> 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
Empty file.
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
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.
This is correct but why is that a case? Why we can't do
console.log(decimalNumber)?