-
-
Notifications
You must be signed in to change notification settings - Fork 332
Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 1 | Structuring and Testing Data #1126
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 all commits
54a88fb
4c84db9
f60234b
e49b1fc
fc3d35e
578f816
cfe1b0c
3b76794
122b382
705d9fb
28d4987
f94b1e6
ffee9e4
90e2625
4a031a0
b67539e
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,13 @@ 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 | ||
|
|
||
| console.log(num); | ||
|
|
||
| //num is a random number [1,100] | ||
| //Math.floor rounds the decimal number to nearest lower number | ||
| // Math.random() generates a random decimal number between 0 and 1 | ||
|
Comment on lines
+12
to
+15
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. 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.
For example,
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. Thank you. I have changed this now.
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. This description is still a bit ambiguous. It doesn't quite tell me whether 0 and 1 are included in the range or not.
|
||
| // when max – min need to add +1 or not all the numbers will be | ||
| // included for instance max=5 min=1 5-1=4 but there are | ||
| // 5 numbers, 1, 2, 3, 4,5 so need to +1 | ||
| //• + minimum → shift the range up to start at the minimum value | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| 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? | ||
| //putting two forward slashes at the start of the line makes it a comment, which means the computer will ignore it when running the program |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| //const age = 33; needs to be let or the value cannot be reassigned | ||
| let age = 33; | ||
| age = age + 1; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| // 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}`); | ||
| //console.log(`I was born in ${cityOfBirth}`); | ||
| //const cityOfBirth = "Bolton"; | ||
| // these are in the wrong order. Cannot access the value of cityOfBirth before it has been declared. Need to declare the variable first and then log it to the console. | ||
|
|
||
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| const 12HourClockTime = "20:53"; | ||
| const 24hourClockTime = "08:53"; | ||
| const 24hourClockTime = "08:53"; | ||
| // variable names cannot begin with a number | ||
| // can change to clockTime12Hour and clockTime24Hour or something similar to make it valid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,21 @@ In the Chrome console, | |
| invoke the function `alert` with an input string of `"Hello world!"`; | ||
|
|
||
| What effect does calling the `alert` function have? | ||
| a pop up box appears saying thecharitych.com says this is an alert | ||
|
|
||
| Now try invoking the function `prompt` with a string input of `"What is your name?"` - store the return value of your call to `prompt` in an variable called `myName`. | ||
|
|
||
| What effect does calling the `prompt` function have? | ||
| a pop up box appears saying thecharitych.com says What is your name | ||
|
|
||
| What is the return value of `prompt`? | ||
|
|
||
| Using: | ||
| const myName = prompt("What is your name?"); | ||
| console.log(myName); | ||
|
|
||
| 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 | ||
|
Comment on lines
+27
to
+31
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. These are all good test cases and observation. Notes:
|
||
Uh oh!
There was an error while loading. Please reload this page.