-
-
Notifications
You must be signed in to change notification settings - Fork 546
London | 26-ITP-Sep | Ebrahim Moqbel | Sprint 3 | coursework CYF-1053 #1468
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
Ebrahim-Moqbel
wants to merge
33
commits into
CodeYourFuture:main
Choose a base branch
from
Ebrahim-Moqbel: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 all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
4032809
A reason for me to join CYF
Ebrahim-Moqbel 50fcc71
Reson
Ebrahim-Moqbel 749a886
What is Git and why is it being used?
Ebrahim-Moqbel 0173fea
Article on the purpos of git
Ebrahim-Moqbel 47925f5
Merge branch 'CodeYourFuture:main' into main
Ebrahim-Moqbel dc50152
Merge branch 'CodeYourFuture:main' into main
Ebrahim-Moqbel 84147a6
form control
Ebrahim-Moqbel 280c8fd
size div
Ebrahim-Moqbel 270dbee
unwanted article deleted
Ebrahim-Moqbel 697f95f
labelling the T-shirt size and chaninging the color section to be rec…
Ebrahim-Moqbel a008f20
I placed the radio buttom name after the radio button input fot the …
Ebrahim-Moqbel c849df2
Merge branch 'main' into Features/Form-Controls
Ebrahim-Moqbel 4338fc8
Merge branch 'CodeYourFuture:main' into Features/Form-Controls
Ebrahim-Moqbel bb65455
completed the key-errors requirements file
Ebrahim-Moqbel 2008962
completed the mandatory debug file
Ebrahim-Moqbel 6db1797
completed the mandatory implement file
Ebrahim-Moqbel b93870e
completed the time format specification file
Ebrahim-Moqbel a1ecaa4
deleting the changes of the from controls file from brach sprint -3
Ebrahim-Moqbel 9a0ba04
Update comments to explain syntax error in 2.js
Ebrahim-Moqbel 3464400
changed the consoled test cases for the toPounds function
Ebrahim-Moqbel 09bea6c
corrected my explanation of the returned and the pass value of pad
Ebrahim-Moqbel c640146
deleted line 12 as it has been stated in line 17
Ebrahim-Moqbel c6908db
separated my explanation to the original task instruction line
Ebrahim-Moqbel 2b62802
consoled log the function and further explained my prediction and the…
Ebrahim-Moqbel f53975c
refactored the calculateBMI to return a string instead of a number
Ebrahim-Moqbel e6fbc4f
added a semicolon in line 21
Ebrahim-Moqbel 2eb14c0
restored the original line of the task
Ebrahim-Moqbel aa32f0e
refactored calculateBMI
Ebrahim-Moqbel 0648881
deleting line 17
Ebrahim-Moqbel b902425
putting back the original version for the first line of the file 3-to…
Ebrahim-Moqbel 38f5a35
correcting my answer in line 40 for the time-format.js file
Ebrahim-Moqbel df570d3
formatted all the files with prettier
Ebrahim-Moqbel 25fa3a3
deleting a line I used for testing
Ebrahim-Moqbel 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,25 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| /* | ||
| I predict the function will throw a SyntaxError as the variable str has already been declared in the function parameter | ||
| function capitalise will capitalise the first letter with index 0 | ||
| and will append the sliced string from index 1 which is the second 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; | ||
| } | ||
| // function capitalise(str) { | ||
| // let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| // return str; | ||
| // } | ||
|
|
||
| // =============> write your explanation here | ||
| /* syntax Error :identifier the variabel has already been declared. | ||
| As we can see the str variable has already been declared in the prameter of the function instead we just return the value */ | ||
|
|
||
| // =============> write your new code here | ||
| function capitalise(str) { | ||
| return str[0].toUpperCase() + str.slice(1); | ||
| } | ||
| console.log(capitalise("ebrahim")); | ||
| console.log(capitalise("salomi")); |
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,27 @@ | ||
|
|
||
| // Predict and explain first BEFORE you run any code... | ||
|
|
||
| // this function should square any number but instead we're going to get an error | ||
|
|
||
| // =============> write your prediction of the error here | ||
| //I predict the funciton will throw a SyntaxEror as the perametters sould be valid variables like names or identifiers with upholding to the variable naming convention and in this case a number found | ||
|
|
||
| function square(3) { | ||
| return num * num; | ||
| } | ||
| // function square(3) { | ||
| // return num * num; | ||
| // } | ||
|
|
||
| // =============> write the error message here | ||
| //the Error is a syntax error: Unexpected number | ||
|
|
||
| // =============> explain this error message here | ||
| /* The function was givin a number as its perameter where in JS only allows varaible names and usnig a number causes a SyntaxError | ||
| */ | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
|
|
||
| // =============> write your new code here | ||
|
|
||
| function square(num) { | ||
| return num * num; | ||
| } | ||
|
|
||
| console.log(square(25)); |
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,23 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // =============> write your prediction here | ||
| // This function would multiply the two arguments a and b | ||
| // when we log the output we will get the string and the output of the function but because we are not returning an output we might run into an error | ||
|
|
||
| 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 | ||
| //The console.log() inside the function will print a*b but when we call the function will return the out put and undefined | ||
| // but after the fix of returning instead it will be working giving the result in that instance will get 320 | ||
|
|
||
| // 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,22 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| // The function suppose to return the sum of the two variables but we will encounter an error as the code after return is unreachable. | ||
|
Ebrahim-Moqbel marked this conversation as resolved.
|
||
|
|
||
| function sum(a, b) { | ||
| return; | ||
| a + b; | ||
| } | ||
|
|
||
| console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
| // function sum(a, b) { | ||
| // return; | ||
| // a + b; | ||
| // } | ||
| // console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
|
|
||
| // =============> write your explanation here | ||
|
|
||
| // As we return nothing by closing the line with a semicolon hence a + b is not returned where we tell the computer to exit and go back to global scope and the computer will not be able to read the lines after that | ||
|
|
||
| // 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
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,6 +1,26 @@ | ||
| // In Sprint-1, there is a program written in 3-mandatory-interpret/3-to-pounds.js | ||
| // In Sprint-1, there is a program written in in 3-mandatory-interpret/3-to-pounds.js. | ||
|
|
||
| // You will need to take this code and turn it into a reusable block of code. | ||
| // 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(penceString) { | ||
| const penceStringWithoutTrailingP = penceString.substring( | ||
| 0, | ||
| penceString.length - 1, | ||
| ); | ||
| const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); | ||
| const pounds = paddedPenceNumberString.substring( | ||
| 0, | ||
| paddedPenceNumberString.length - 2, | ||
| ); | ||
|
|
||
| const pence = paddedPenceNumberString | ||
| .substring(paddedPenceNumberString.length - 2) | ||
| .padEnd(2, "0"); | ||
| return `£${pounds}.${pence}`; | ||
| } | ||
|
|
||
| console.log(toPounds("987p")); | ||
| console.log(toPounds("9p")); | ||
| console.log(toPounds("50p")); |
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.
Uh oh!
There was an error while loading. Please reload this page.