-
-
Notifications
You must be signed in to change notification settings - Fork 546
Cape Town | sep-2026-ITP | Matthaus Bause | Sprint 3 | CYF-1053 #1618
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
chefmatthaus-hub
wants to merge
28
commits into
CodeYourFuture:main
Choose a base branch
from
chefmatthaus-hub:acoursework/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
28 commits
Select commit
Hold shift + click to select a range
ced2c8b
Created animal website and index.html
chefmatthaus-hub dfe221f
Part 1 - Creating the repository
chefmatthaus-hub 20df3e3
Added colour options for shirts
chefmatthaus-hub 5817f0b
Changed Footer Name
chefmatthaus-hub 857487a
Added shirt size options
chefmatthaus-hub 66bd2de
Added Customer Details Field
chefmatthaus-hub 8bc3b93
changed shirt color label "for"
chefmatthaus-hub adf2ba2
Added a submit button
chefmatthaus-hub 1979160
added a <p> for the button
chefmatthaus-hub b6c78a5
Neatened my line of code added a few <p> and <div>
chefmatthaus-hub cf2d074
Added my first .css
chefmatthaus-hub 3c9fa22
Added .css to button
chefmatthaus-hub 04a9d41
Added .css to select
chefmatthaus-hub daa9c1f
Removed shirt size label
chefmatthaus-hub c1fc3d4
added additional hover .css to select
chefmatthaus-hub 4e8e014
added .css to input
chefmatthaus-hub 0300b47
corrected email address field type to from "text" to "email"
chefmatthaus-hub 1543377
added select option to option field
chefmatthaus-hub bb8c532
added .css to field set
chefmatthaus-hub f873d15
added "aria-label" to select field
chefmatthaus-hub eb8a31f
Delete animal-website/index.html
chefmatthaus-hub 15d2158
Delete git-collaboration/animal-website/index.html
chefmatthaus-hub f8c3552
added a style sheet file
chefmatthaus-hub abf9de6
made some required attributes
chefmatthaus-hub cdb761b
Sprint-3/
chefmatthaus-hub 47f65d6
feat: complete sprint-3
chefmatthaus-hub f839af8
Restore Form-Controls files and remove accidental files
chefmatthaus-hub f2aa74a
Remove unrelated Form-Controls changes
chefmatthaus-hub 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,23 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| // It will make the first letter in the string input capitalised. | ||
|
|
||
| // call the function capitalise with a string input | ||
| // interpret the error message and figure out why an error is occurring | ||
| // "SyntaxError: Identifier 'str' has already been declared" | ||
|
|
||
| // capitalise("matthaus enjoys foood.") | ||
|
|
||
| // function capitalise(str) { | ||
| // let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| // return str; | ||
| // } | ||
|
|
||
| // The error is thrown by declaring the 'str' variable again in the function with 'let' which causes it throw the SyntaxError, as it is already been declared. | ||
|
|
||
| capitalise("matthaus enjoys food") | ||
|
|
||
| function capitalise(str) { | ||
| let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| return str; | ||
| return `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| } | ||
|
|
||
| // =============> write your explanation here | ||
| // =============> write your new code here | ||
| console.log(capitalise("Matthaus enjoys food")); |
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... | ||
| // It will give you a percentage of 50% using the function by multiplying the 'decimalNumber' by 100 for the 'percentage' variables. | ||
|
|
||
| // Why will an error occur when this program runs? | ||
| // =============> write your prediction here | ||
| // It will be a syntaxError because the 'decimalNumber' is already called in the function parameter. | ||
|
|
||
| // Try playing computer with the example to work out what is going on | ||
|
|
||
| // function convertToPercentage(decimalNumber) { | ||
| // const decimalNumber = 0.5; | ||
| // const percentage = `${decimalNumber * 100}%`; | ||
|
|
||
| // return percentage; | ||
| // } | ||
|
|
||
| // console.log(decimalNumber); | ||
|
|
||
| // decimalNumber in console.log isn't a defined number in the functions parameter now so it will return back as NaN "Not a Number", by adding '0.05' to the console.log it now has a number to calculate the percentage to | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
|
|
||
|
|
||
| function convertToPercentage(decimalNumber) { | ||
| const decimalNumber = 0.5; | ||
| const percentage = `${decimalNumber * 100}%`; | ||
|
|
||
| return percentage; | ||
| } | ||
|
|
||
| console.log(decimalNumber); | ||
|
|
||
| // =============> write your explanation here | ||
| } | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
|
|
||
| // Predict and explain first BEFORE you run any code... | ||
| // The function won't return be able to return the value to the caller, due to the expression not being assigned. | ||
|
|
||
| // this function should square any number but instead we're going to get an error | ||
|
|
||
| // =============> write your prediction of the error here | ||
| // The expression will return as unexpected number in the console log | ||
|
|
||
| function square(3) { | ||
| return num * num; | ||
| } | ||
| // function square(3) { | ||
| // return num * num; | ||
| // } | ||
|
|
||
| // =============> write the error message here | ||
| // SyntaxError: Unexpected number | ||
|
|
||
| // =============> explain this error message here | ||
| // The parameter set by the function isn't attached to the num value of the return, so the return doesn't have a value to work with | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
|
|
||
| // =============> write your new code here | ||
| function square(num) { | ||
| return num * num; | ||
| } | ||
|
|
||
| console.log(square(3)); | ||
|
|
||
|
|
||
|
|
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,18 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // =============> write your prediction here | ||
| // There is no return in the function, the wrong use of console.log is being used, therefore the function isn't being closed and only is the console.log being logged twice, causing the function's parameters to be defined by the return. | ||
|
|
||
| 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 instead of console.log being used in the functions expression, there should be a return. | ||
|
|
||
| // 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,17 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| // By using the semi-colon after the return, this is closing off the function and leaving the parameters as undefined, causing the console.log state that the parameters are undefined. | ||
|
|
||
| // function sum(a, b) { | ||
| // return; | ||
| // a + b; | ||
| // } | ||
|
|
||
| // console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
|
|
||
| // by using the semi-colon after the return, and having the parameters put into a separate line, the return can't define the parameters of the function. | ||
| // Finally, correct the code to fix the problem | ||
| function sum(a, b) { | ||
| return; | ||
| a + b; | ||
| return a + b; | ||
| } | ||
|
|
||
| console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
|
|
||
| // =============> write your explanation here | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here |
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,24 +1,36 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // Predict the output of the following code: | ||
| // =============> Write your prediction here | ||
| // Because the num variable is defined globally and the function doesn't set the parameter using num, which isn't being called and the consol.log ignores it and refers back to the global variable being set on line 6 | ||
|
|
||
| // const num = 103; | ||
|
|
||
| // function getLastDigit() { | ||
| // return num.toString().slice(-1); | ||
| // } | ||
|
|
||
| // console.log(`The last digit of 42 is ${getLastDigit(42)}`); | ||
| // console.log(`The last digit of 105 is ${getLastDigit(105)}`); | ||
| // console.log(`The last digit of 806 is ${getLastDigit(806)}`); | ||
|
|
||
| // Now run the code and compare the output to your prediction | ||
| // The last digit of 42 is 3 | ||
| // The last digit of 105 is 3 | ||
| // The last digit of 806 is 3 | ||
|
|
||
| // Explain why the output is the way it is | ||
| // There is no parameter set in the function, so the function when called is ignored and the console.log only outputs the const variable of num | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
| const num = 103; | ||
|
|
||
| function getLastDigit() { | ||
| function getLastDigit(num) { | ||
| return num.toString().slice(-1); | ||
| } | ||
|
|
||
| console.log(`The last digit of 42 is ${getLastDigit(42)}`); | ||
| console.log(`The last digit of 105 is ${getLastDigit(105)}`); | ||
| console.log(`The last digit of 806 is ${getLastDigit(806)}`); | ||
|
|
||
| // Now run the code and compare the output to your prediction | ||
| // =============> write the output here | ||
| // Explain why the output is the way it is | ||
| // =============> write your explanation here | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
|
|
||
| // This program should tell the user the last digit of each number. | ||
| // Explain why getLastDigit is not working properly - correct the problem |
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.
Note: The .slice() method supports negative indices, which count positions from the end of the string.
For example,
str.slice(-3)returns the substring containing last three characters fromstr.