Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 1 | Structuring and Testing Data#1126
Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 1 | Structuring and Testing Data#1126mshayriyesaricicek wants to merge 19 commits intoCodeYourFuture:mainfrom
Conversation
Sprint-1/1-key-exercises/4-random.js
Outdated
|
|
||
| //num is a random number between 1 and 100 | ||
| //Math.floor rounds the decimal number to nearest lower number | ||
| // Math.random() generates a random decimal number between 0 and 1 |
There was a problem hiding this comment.
Phrases like "a number between X and Y" are not precise enough in a program specification, because they do not clearly state whether the endpoints X and Y are included.
We can also use the concise and precise interval notation to describe a range of values.
[,]=> inclusion(,)=> exclusion
For example, [1, 10) means, all numbers between 1 and 10, including 1 but excluding 10.
There was a problem hiding this comment.
Thank you. I have changed this now.
There was a problem hiding this comment.
This description is still a bit ambiguous. It doesn't quite tell me whether 0 and 1 are included in the range or not.
// Math.random() generates a random decimal number between 0 and 1
cjyuan
left a comment
There was a problem hiding this comment.
Can you update the Markdown syntax of the checkboxes in the PR description to make them look like this:
- I have tested my changes
instead of like this:
- [X ] I have tested my changes
Sprint-1/1-key-exercises/4-random.js
Outdated
|
|
||
| //num is a random number between 1 and 100 | ||
| //Math.floor rounds the decimal number to nearest lower number | ||
| // Math.random() generates a random decimal number between 0 and 1 |
There was a problem hiding this comment.
This description is still a bit ambiguous. It doesn't quite tell me whether 0 and 1 are included in the range or not.
// Math.random() generates a random decimal number between 0 and 1
Sprint-1/4-stretch-explore/chrome.md
Outdated
| If I click ok without entering my name the prompt goes off the screen and console.log returns undefined | ||
|
|
||
| If I click cancel without entering my name the promptgoes off the screen and console.log null undefined | ||
|
|
||
| If I put my name Hayriye in and click ok then it goes off the screen and console.log returns Hayriye No newline at end of file |
There was a problem hiding this comment.
These are all good test cases and observation.
In each case, what value does prompt() return?
Notes:
console.log()outputs the value you see on console; it does not return those values.- For more definite info about
prompt(), "MDN Web Docs" is a good resource.
There was a problem hiding this comment.
I have changed the markdown to ticks.
I have changed the answers in Sprint-1/1-key-exercises/4-random.js and Sprint-1/4-stretch-explore/chrome.md
cjyuan
left a comment
There was a problem hiding this comment.
Changes to the code and PR description are good. Well done.
Just one more more clarification needed.
Sprint-1/1-key-exercises/4-random.js
Outdated
|
|
||
| //num is a random number between 1 and 100 including 1 and 100 [1,100] | ||
| //Math.floor rounds the decimal number to nearest lower number | ||
| // Math.random() generates a random decimal number between 0 and 1 including 0 and 1 [0,1] |
There was a problem hiding this comment.
// Math.random() generates a random decimal number between 0 and 1 including 0 and 1 [0,1]
How did you figure it includes both 0 and 1? Is this information obtained from a reliable source?
There was a problem hiding this comment.
I think I was getting confused. I checked on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random and I can see now it includes 0 but not 1 so have changed it on my pull request. Thank you for your patience.
|
Changes look good. Well done! |
Self checklist
Changelist
I am completing the exercises on Sprint 1. I am making commits as I continue.