generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 245
West Midlands | ITP-Sept-2025 | Ali Naru | Sprint 3 | Coursework/sprint-1 #770
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
MohammedNaru
wants to merge
17
commits into
CodeYourFuture:main
Choose a base branch
from
MohammedNaru:coursework/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
17 commits
Select commit
Hold shift + click to select a range
07c5cbe
Add comments to clarify variable declaration and assignment in count.js
MohammedNaru 7bca1d2
Implement initials extraction and log output in 2-initials.js
MohammedNaru 2b57ffd
Fix variable assignments for dir and ext in 3-paths.js
MohammedNaru 76e3f65
Enhance comments to clarify the random number generation process in 4…
MohammedNaru afca59a
Refactor comments for clarity and fix variable naming conflict in cap…
MohammedNaru 2b12a34
Change age from constant to variable for reassignment and update comm…
MohammedNaru b7a8c22
Fix variable hoisting issue by moving cityOfBirth declaration above c…
MohammedNaru 993c40c
Fix last4Digits assignment by converting cardNumber to string and upd…
MohammedNaru d8109f2
Rename variables to avoid starting with numbers and update comments f…
MohammedNaru 13c32aa
Fix syntax error in priceAfterOneYear assignment and enhance comments…
MohammedNaru 5f6ff93
Enhance comments for clarity and remove unnecessary lines in time for…
MohammedNaru f4d3f59
Refactor comments for clarity and remove redundant explanations in 3-…
MohammedNaru a33085b
Restore original file contents
MohammedNaru b401592
Rename variables to follow camelCase convention in 4.js
MohammedNaru 6106da7
Refactor random number generation to use constants MIN and MAX, and e…
MohammedNaru e2f242e
Enhance comments for clarity and remove unnecessary lines in 3-paths.js
MohammedNaru bd66e0c
Merge branch 'main' into coursework/sprint-1
MohammedNaru 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
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,9 +1,11 @@ | ||
| const minimum = 1; | ||
| const maximum = 100; | ||
| // MIN and MAX are constants that define the lower and upper bounds for our random number range. | ||
| const MIN = 1; | ||
| const MAX = 10; | ||
|
|
||
| const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; | ||
| // Math.random() returns a decimal value in the interval [0, 1) | ||
| // Multiplying by (MAX - MIN + 1) scales the interval to [0, MAX - MIN + 1) | ||
| // Applying Math.floor() converts the value to an integer within [s0, MAX - MIN] | ||
| // Finally, adding MIN shifts the interval to [MIN, MAX], which is our desired result. | ||
|
|
||
| // In this exercise, you will need to work out what num represents? | ||
| // Try breaking down the expression and using documentation to explain what it means | ||
| // It will help to think about the order in which expressions are evaluated | ||
| // Try logging the value of num and running the program several times to build an idea of what the program is doing | ||
| const num = MIN + Math.floor(Math.random() * (MAX - MIN + 1)); | ||
| console.log(num); |
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,4 @@ | ||
| 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? | ||
|
|
||
| // in code use backslashes to create 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,8 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| let age = 33; // changed from constant to variable so that value can be reassigned | ||
| age = age + 1; | ||
| console.log(age); // should print 34 running testing | ||
|
|
||
|
|
||
| //after testing can confirm age variable is now 34. |
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,9 +1,18 @@ | ||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = cardNumber.slice(-4); | ||
| //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 | ||
| // CardNumber is not a funtion so it does not have the method slice. | ||
|
|
||
| // Then run the code and see what error it gives. | ||
| // TypeError: cardNumber.slice is not a function | ||
| // Consider: Why does it give this error? Is this what I predicted? If not, what's different? | ||
| //this is what I predicted because slice is a method for strings and arrays, not numbers. | ||
| // Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
|
|
||
|
|
||
| const last4DigitsCorrected = cardNumber.toString().slice(-4); | ||
|
|
||
| console.log(last4DigitsCorrected); // Should output: 4213 |
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 @@ | ||
| const 12HourClockTime = "20:53"; | ||
| const 24hourClockTime = "08:53"; | ||
| const twelveHourClockTime = "20:53"; | ||
| const twentyFourHourClockTime = "08:53"; | ||
|
|
||
|
|
||
| //Variables cannot have numbers at the start of their name | ||
| //the times are in the wrong format for their variable names |
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
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.