-
-
Notifications
You must be signed in to change notification settings - Fork 398
West-Midlands | 26-ITP-May | Maryam Janjua | Sprint 2 | Sprint 2 Coursework #1523
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
maryam-devio
wants to merge
20
commits into
CodeYourFuture:main
Choose a base branch
from
maryam-devio:acoursework/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
3d1b781
Corrected Error by Assigning Value
maryam-devio c8b7d5a
make some changes in file 0.js
maryam-devio c45088d
Fixed Errors for 1.js
maryam-devio 616dc24
Fixed Errors for 1.js
maryam-devio 815729e
Fixed Erros for 2.js
maryam-devio 5e3518c
Fixed Return statment
maryam-devio 698726b
Fixed code for 1.js
maryam-devio 5ddb233
Fixed Function's Paramter for 2.js
maryam-devio fcd51d7
Programme to Calculate BMI
maryam-devio 4ac532b
Programme to convert string in UpperCase with Underscore
maryam-devio d50ef0b
Function to convert into pounds
maryam-devio 952149c
Interpreted Programme
maryam-devio 0cfe806
write and test edge cases
maryam-devio d07c452
Update Function's parameter for 2.js
maryam-devio 80d46f6
Upadte function by removing reassignment of paramter
maryam-devio b1c4bb0
Update function
maryam-devio 20e2919
Corrected BMI formula
maryam-devio 766e9b5
Update function for 3-to-pounds.js
maryam-devio 0772043
Update format time
maryam-devio 1137966
Update format time
maryam-devio 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,13 +1,20 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
|
|
||
| // The Error will occur because we are trying to create a variable with same name in same scope. | ||
| // 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)}`; | ||
| str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| return str; | ||
| } | ||
|
|
||
| let str = 'hello'; | ||
| console.log(capitalise(str)); | ||
| // =============> write your explanation here | ||
| // =============> write your new code here | ||
| //By capitilise(str)-> we have created a function with parameter str. | ||
| // Inside the function, `str` is already declared as a local variable because it is a parameter. | ||
| // We can't declare another variable with the same name using `let` in the same scope. | ||
| // It was giving an error because we were trying to declare `str` again using `let`. | ||
| // I corrected it by removing `let` because we don't need to create another variable with the same name; we just have to assign a new value to the existing `str`. | ||
| // Outside the function, I created another variable with the same name, `str`. We can do this because it is in a different scope. |
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 | ||
|
|
||
| function multiply(a, b) { | ||
| // In this example function is being called but as there's no return statement so it will return undefined. | ||
| // and a *b multiplication. and the line on line 10 | ||
| /*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 | ||
|
|
||
| // I fixed it by adding a return statement and create another variable outside of the function that stores, | ||
| //value of function. | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function multiply(a, b) { | ||
| return (a*b); | ||
| } | ||
| const result = multiply(10,32); | ||
| console.log(`The result of multiplying 10 and 32 is ${result}`); |
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 | ||
|
|
||
| function sum(a, b) { | ||
| //It will give an error as we have to mention what are we returning, by simply putting the return statement doesn't automatically | ||
| //return anything, except undefined, and then we are doing an addition of two number but we haven't return the result of it, | ||
| //when the function will be called in line 11, it will print undefined with the sentence mentioned in literals. | ||
| /*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 | ||
| //I firstly fixed the return statement. | ||
| //outside of the function I create another variable that stores function value. | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
|
|
||
| function sum(a, b) { | ||
| return a+b; | ||
| } | ||
| const result = sum(10,32); | ||
| console.log(`The sum of 10 and 32 is ${result}`); |
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.
Good catch. However, please review the function's output, it seems to be returning the same result for every input.
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.
Thanks for the feedback! I have corrected the issue by removing the reassignment of the function parameter. The function now uses the argument passed to it, so it returns the correct percentage for different input values.