generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 218
Glasgow | 25-ITP-SEP | Mohammed Abdoon | Sprint 1 | Coursework/sprint-1 #708
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
M-Abdoon
wants to merge
26
commits into
CodeYourFuture:main
Choose a base branch
from
M-Abdoon: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
26 commits
Select commit
Hold shift + click to select a range
6e357c7
described code in 1-count.js
M-Abdoon 38f900a
Declared a variable that calles the first charachter of each string
M-Abdoon b82600e
created 2 variables in 3-paths.js , one is to store the fir part of t…
M-Abdoon dcf3d6f
Manipulated the code several times to get an idea of how the works a…
M-Abdoon 7489fae
converted the lines into comments so the program does not run them
M-Abdoon 88e4a0d
Changed the declaration type of the variable from const to let so we …
M-Abdoon 65ed66e
I put the declaration of the variable on the top so the program knows…
M-Abdoon b724d4c
Coverted the cardnumber from a number to string so it can be sliced
M-Abdoon 5df6d91
Removed numbers from the begining of the variables' names
M-Abdoon ecc906b
code identified, error solved, questions answered
M-Abdoon 96f2e35
Exercise 3-time-format solved
M-Abdoon c1aeb97
exercies 3-to-pounds solved
M-Abdoon 5bf0726
Chrome.md done
M-Abdoon e7f49b1
objects.md questions answered.
M-Abdoon 27ccab3
Sprint 1 Done!
M-Abdoon e86db1a
Update 4-random.js -- Removed testing line
M-Abdoon 70edf9c
Update 4-random.js -- returned values to default
M-Abdoon 43a32bb
Update 3.js -- Removed testing line
M-Abdoon 13dbe89
Variable declared twice fixed
M-Abdoon acaa18f
ignore unintentionally uploaded file
M-Abdoon 076088c
deleted unintentionally uploaded file
M-Abdoon fa3471c
Update .gitignore
M-Abdoon 667cc7a
Update .gitignore
M-Abdoon cada88b
added an explaination of the code and what is actually does.
M-Abdoon 762dcdf
Merge branch 'coursework/sprint-1' of https://github.com/M-Abdoon/Mod…
M-Abdoon 21231d3
updated the code explaination
M-Abdoon 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,5 @@ | ||
node_modules | ||
.DS_Store | ||
.vscode | ||
**/.DS_Store | ||
testing.js | ||
**/.DS_Store |
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,22 @@ | ||
const minimum = 1; | ||
const maximum = 100; | ||
|
||
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; | ||
num = Math.floor(Math.random() * (maximum - minimum) + 1); | ||
|
||
//console.log(num); | ||
|
||
// 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 | ||
|
||
// 1. const minimum = 1; : a variable has the name `minimum` declared. it stores hte 1 value. `const` means this var is unchangeable. | ||
// 2. const maximum = 100; a variable has the name `maximum` declared. it stores hte 100 value. `const` means this var is unchangeable. | ||
// 4. num = Math.floor(Math.random() * (maximum - minimum) + 1); : in this line, the variable `num` is declared, it stores a random number | ||
// between 1 and 100. Math.random() generates a random decimal number between 0 and 1 (exclusive). | ||
// then it multiplies this random number by (maximum - minimum) to scales it to a range between 0 and 99 (since maximum is 100 and minimum is 1). | ||
// Adding 1 shifts this range to be between 1 and 100. | ||
// the line had a mistake, it was declared as const num = ... but I changed it to num = ... because const means unchangeable, and here we want to change its value each time we run the code. | ||
// Math.floor() then rounds down the result number to the nearest whole number, and ensures that num is an integer between 1 and 100. | ||
|
||
// So the whole code generates a random integer between 1 and 100 (inclusive) and stores it in the variable 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? | ||
|
||
// we can prevent the pc from running those lines by adding the commenting // lines |
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,4 @@ | ||
// trying to create an age variable and then reassign the value by 1 | ||
|
||
const age = 33; | ||
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,5 @@ | ||
// 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}`); |
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,17 @@ | ||
const cardNumber = 4533787178994213; | ||
const cardNumber = "4533787178994213"; | ||
const last4Digits = cardNumber.slice(-4); | ||
|
||
//console.log(last4Digits); | ||
// 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 | ||
|
||
// I assume the code won't work because the value inside "slice()" isn't valid. | ||
// because we should set a valid number or 2 numbers (the first num is to set from where to start, | ||
// the second number is to set where to finish) | ||
|
||
// Update: after the first run of the code I realized that CardNumber is actually a number not a string. | ||
// so I think if I convert it into string the code will work properly. No problem with "slice()" value. |
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 @@ | ||
const 12HourClockTime = "20:53"; | ||
const 24hourClockTime = "08:53"; | ||
const HourClockTime = "20:53"; | ||
const hourClockTime = "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
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 was deleted.
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.
The goal in this task is to offer an explanation of what this code is doing - can you add some comments breaking down what this code is doing bit by bit and then offer a general summary of what is happening?
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.
Thank you.
Yes, I added an explanation of the code, why I made the small change and what the code is actually doing.