-
-
Notifications
You must be signed in to change notification settings - Fork 546
Cape Town | 26-ITP-Sept | Lamla Kamana | Sprint 2 | JavaScript Fundamentals Coursework #1569
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
lamlakamana-oss
wants to merge
24
commits into
CodeYourFuture:main
Choose a base branch
from
lamlakamana-oss: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
24 commits
Select commit
Hold shift + click to select a range
0527d28
Add name field with required and pattern validation
lamlakamana-oss db804ea
Add email field with required validation
lamlakamana-oss b3a5762
Add clour field with radio buttons
lamlakamana-oss c9f584d
Add with dropdown validation
lamlakamana-oss 612d7a1
Fix doctype and improve touch target sizing
lamlakamana-oss ba0cad3
Move CSS to external stylesheet per review feedback
lamlakamana-oss 3bba3ba
Fix indentation in Form-Controls/index.html
lamlakamana-oss 95a2e5b
Completed exercises 1 and 2 in Sprint 2
lamlakamana-oss 70cfb4a
Complete exercise 3 in Sprint 2
lamlakamana-oss dd4f83e
Complete exercise 4 in Sprint 2
lamlakamana-oss 3986f03
Fix 0.js by wrapping instruction lines in a comment
lamlakamana-oss e4c6e45
Fix 1.js: use let instead of const to allow reassignment
lamlakamana-oss 19c93a0
Fix 2.js: declare cityOfBirth before usage, add explanation
lamlakamana-oss 5c39a47
Fix 3.js: convert cardNumber to string so slice works, add explanation
lamlakamana-oss 0707b11
Fix 4.js: rename variables to not start with a digit, add explanation
lamlakamana-oss fa5c077
Add interpretation answers for 1-percentage-change.js
lamlakamana-oss 411575d
Add interpretation answers for 2-time-format.js
lamlakamana-oss 4eab121
Add interpretation breakdown for 3-to-pounds.js
lamlakamana-oss 8e06726
Add answers for chrome.md stretch exercise
lamlakamana-oss e99d5ac
Add answers for objects.md stretch exercise
lamlakamana-oss 540d4d6
Remove Form-Controls changes not part of Sprint 2
lamlakamana-oss c37af97
Update 1-percentage-change.js
lamlakamana-oss 300176d
Answer question e and rename result variable
lamlakamana-oss b85aff0
Answer question e
lamlakamana-oss 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,6 +1,7 @@ | ||
| let count = 0; | ||
|
|
||
| count = count + 1; | ||
|
|
||
| // Line 3 is using the assignment operator (=) to update the value of `count`. | ||
| // It takes the current value of `count` (0), adds 1 to it, and assigns the new value (1) back to `count`. | ||
| // This effectively increases the value of `count` by 1. | ||
| // Line 1 is a variable declaration, creating the count variable with an initial value of 0 | ||
| // Describe what line 3 is doing, in particular focus on what = is doing |
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,2 +1,2 @@ | ||
| This is just an instruction for the first activity - but it is just for human consumption | ||
| We don't want the computer to run these 2 lines - how can we solve this problem? | ||
| /*This is just an instruction for the first activity - but it is just for human consumption | ||
| We don't want the computer to run these 2 lines - how can we solve this*/ |
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,4 +1,10 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| let age = 33; | ||
| age = age + 1; | ||
|
|
||
| // Error: TypeError: Assignment to constant variable. (at 1.js:4:5) | ||
| // Cause: On line 4, the code is trying to change the value of `age`. However, | ||
| // `age` was created using `const`, which means its value cannot be | ||
| // changed after it has been assigned. | ||
| // Fix: If the value of a variable needs to change later, use `let` instead of `const`. |
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,5 +1,11 @@ | ||
| // Currently trying to print the string "I was born in Bolton" but it isn't working... | ||
| // what's the error ? | ||
|
|
||
| console.log(`I was born in ${cityOfBirth}`); | ||
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); | ||
|
|
||
| // Error:** `ReferenceError: Cannot access 'cityOfBirth' before initialization (at 2.js:4:30)` | ||
|
|
||
| // Cause:** Line 4 is trying to use `cityOfBirth` before the variable has been created. The variable is only declared on line 5, and JavaScript processes the code from top to bottom. | ||
|
|
||
| // Fix:** Declare and assign `cityOfBirth` before using it in the code. |
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,9 +1,15 @@ | ||
| const cardNumber = 4533787178994213; | ||
| const cardNumber = "4533787178994213"; | ||
| const last4Digits = cardNumber.slice(-4); | ||
|
|
||
| // The last4Digits variable should store the last 4 digits of cardNumber | ||
| // However, the code isn't working | ||
| // Before running the code, make and explain a prediction about why the code won't work | ||
| // Then run the code and see what error it gives. | ||
| // Consider: Why does it give this error? Is this what I predicted? If not, what's different? | ||
| // Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
| // PREDICTION: This code will result in a TypeError because cardNumber is a number, | ||
| // and numbers don't have a .slice() method (it only exists on strings). | ||
| // | ||
| // ACTUAL ERROR: TypeError: cardNumber.slice is not a function (at 3.js:2:32) | ||
| // Was my prediction correct? YES — it was indeed a TypeError caused by calling | ||
| // a string method on a number. | ||
| // | ||
| // Fix: Make cardNumber a string by wrapping it in quotes: "4533787178994213". | ||
| // (Card numbers should be strings in real life — they can have leading zeros | ||
| // and are too large for the Number type.) | ||
|
|
||
| console.log(last4Digits); |
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,2 +1,10 @@ | ||
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
| const twelveHourClockTime = "8:53pm"; | ||
| const twentyFourHourClockTime = "20:53"; | ||
|
|
||
| // Error: SyntaxError: Invalid or unexpected token | ||
| // Cause: I originally named the variables 12HourClockTime and 24hourClockTime, | ||
| // but JavaScript doesn't allow variable names to start with a number. | ||
| // They have to start with a letter, an underscore, or a dollar sign. | ||
| // The parser was reading 12 as a number and then got stuck on the "H". | ||
| // Fix: Renamed them to twelveHourClockTime and twentyFourHourClockTime so they | ||
| // start with letters instead of digits. |
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.
Uh oh!
There was an error while loading. Please reload this page.