-
-
Notifications
You must be signed in to change notification settings - Fork 337
London | JAN-2026 ITP | Ebrahim Moqbel | Sprint 1 | Coursework #1074
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
base: main
Are you sure you want to change the base?
Changes from 12 commits
51a060d
795be43
2b4173b
c77e1c3
e829acf
2ddf2a2
985f34c
dc4066c
c703ce2
1687eb5
4f40f6e
4bd0d32
eae4c22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,9 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; | |
| // 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 | ||
|
|
||
| // math.floor will make the number as a whole and remove any decimals or more likely to round the the nearest whole number | ||
| // math.random returns a random number in [0,1) | ||
| // (maximum - minimum + 1) provide a range of generated random number | ||
| // num is a random whole number [1,100) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the value of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No the notation ( , ) would exclude the number therefore 100 wouldn't be generated.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You figured out Can you use the interval notation to describe what each of these expressions does, and the range of the numbers it may produce?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you instead show the interval of the values that can be generated by each of the expressions? Note: |
||
| console.log(num); | ||
| 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 problem? |
| 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; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| // 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}`); | ||
| //const cityOfBirth = "Bolton"; | ||
|
|
||
| // the error is that cityOfBirth varaible declared after the logging command |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| 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 | ||
| // 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 predicted the last four digits bit it has to be a string in order to use the method slice and that explain why it wasn't working | ||
| const last4Digits = cardNumber.toString.slice(-4); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| const 12HourClockTime = "20:53"; | ||
| const 24hourClockTime = "08:53"; | ||
| const twelveHourClockTime = "20:53"; | ||
| const twentyFourHourClockTime = "08:53"; |
Uh oh!
There was an error while loading. Please reload this page.