generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 275
London | 25-ITP-Sept | Samuel Tarawally | Sprint 1 | Coursework #819
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
Tarawally
wants to merge
15
commits into
CodeYourFuture:main
Choose a base branch
from
Tarawally:sprint-1
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
15 commits
Select commit
Hold shift + click to select a range
9b83b30
docs(key-exercises): explain variable reassignment in 1-count.js
Tarawally b6ec84d
feat: add initials variable from first, middle, and last names
Tarawally a3978a4
feat(key-exercies): complete paths by deriving dir and ext
Tarawally 8e8c891
feat: add detailed breakdown of random number generation logic
Tarawally 09dc15f
chore(gitignore): broaden ignores for Node/JS, IDEs, env and docs
Tarawally 103635d
refactor(sprint-1): simplify initials template literal
Tarawally d7626de
fix(sprint-1): resolve ReferenceError by declaring greeting outside b…
Tarawally 78c9889
fix(sprint-1): resolve TypeError by using let instead of const
Tarawally 4d64b5e
fix(sprint-1): resolve SyntaxError by using unique variable names
Tarawally 6011f82
fix(sprint-1): resolve ReferenceError by declaring variable before use
Tarawally dd6fc22
fix(sprint-1): resolve TypeError by checking array bounds before acce…
Tarawally cdd71c3
docs(sprint-1): add concise answers for percentage change interpretation
Tarawally 802c33a
docs(sprint-1): add concise answers for time format interpretation
Tarawally df747db
docs(sprint-1): add concise answers for currency conversion interpret…
Tarawally 34cd9f5
chore: format Sprint-1 files with Prettier
Tarawally 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,4 +1,39 @@ | ||
| node_modules | ||
| # Generated .gitignore file for: Node, JavaScript | ||
| # Created with FOSSA's DevOps Tools | ||
|
|
||
| # Node | ||
| node_modules/ | ||
| npm-debug.log | ||
| yarn-error.log | ||
| .env | ||
| .DS_Store | ||
| .vscode | ||
| **/.DS_Store | ||
| dist/ | ||
| .cache/ | ||
| coverage/ | ||
|
|
||
| # JavaScript | ||
| # Add JavaScript-specific ignores here | ||
| package-lock.json | ||
|
|
||
| # Notebooks and documentation | ||
| docs/ | ||
|
|
||
| # Common | ||
| .DS_Store | ||
| Thumbs.db | ||
| *.log | ||
| *.bak | ||
| *.tmp | ||
| *.swp | ||
| *~ | ||
|
|
||
| # IDE and editor generated files | ||
| .idea/ | ||
| *.sublime-* | ||
| .vscode/ | ||
| .devcontainer/ | ||
|
|
||
| # Local environment files | ||
| .env | ||
| .env.local | ||
| .env.*.local |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| 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 problem? | ||
|
|
||
| // Answer: Use comments (//) to prevent execution | ||
| // SyntaxError: Unexpected identifier - plain text is not valid JavaScript | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#comments |
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,11 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| // const age = 33; | ||
| // age = age + 1; | ||
|
|
||
| // TypeError: Assignment to constant variable - `const` cannot be reassigned | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const | ||
|
|
||
| // Solution: | ||
| let age = 33; | ||
| age = age + 1; |
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,12 @@ | ||
| // Currently trying to print the string "I was born in Bolton" but it isn't working... | ||
| // what's the error ? | ||
| // What's the error? | ||
|
|
||
| console.log(`I was born in ${cityOfBirth}`); | ||
| // console.log(`I was born in ${cityOfBirth}`); | ||
| // const cityOfBirth = "Bolton"; | ||
|
|
||
| // ReferenceError: Cannot access 'cityOfBirth' before initialization - temporal dead zone | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const#temporal_dead_zone_tdz | ||
|
|
||
| // Solution: | ||
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); |
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,16 @@ | ||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = cardNumber.slice(-4); | ||
| // 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 | ||
|
|
||
| // TypeError: cardNumber.slice is not a function - .slice() exists on strings, not numbers | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice | ||
|
|
||
| // Solution: | ||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = String(cardNumber).slice(-4); |
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,9 @@ | ||
| const 12HourClockTime = "20:53"; | ||
| const 24hourClockTime = "08:53"; | ||
| // const 12HourClockTime = "20:53"; | ||
| // const 24hourClockTime = "08:53"; | ||
|
|
||
| // SyntaxError: Invalid or unexpected token - variable names cannot start with a digit | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#variables | ||
|
|
||
| // Solution: | ||
| const twelveHourClockTime = "20:53"; | ||
| const twentyFourHourClockTime = "08:53"; |
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.
Operation like
count = count + 1is very common in programming, and there is a programming term describing such operation.Can you find out what one-word programming term describes the operation on line 3?