You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//num represents a randomly generated whole number between 1 and 100.
8
8
9
9
// Try breaking down the expression and using documentation to explain what it means
10
-
// Math.random() generates a random decimal number greater than or equal to 0 and less than 1. Multiplying by 100 gives a number between 0 and up to, but not including 100.
11
-
// Math.floor() always rounds down and returns the largest integer less than or equal to a given number in this case between 0 and 99. Finally, adding 1 changes the range to 1–100.
// Math.random give any random number between 0 to 1 example 0.225 * 100 = 22.5
16
-
// Math.floor rounds that number to a whole number so 22.5 will become 22
17
-
// (22) + minimum
18
-
// 22 + 1
19
-
// 23
20
-
10
+
// Math.random() generates a random decimal number greater than or equal to 0 and less than 1. Multiplying by 100 gives a number between 0 and up to, but not including 100.
11
+
// Math.floor() always rounds down and returns the largest integer less than or equal to a given number in this case between 0 and 99. Finally, adding 1 changes the range to 1–100.
// Remainder operator : calculates the remainder after dividing the movie length in seconds by 60
20
+
// Remainder operator : calculates the remainder after dividing the movie length in seconds by 60
21
21
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22
-
// It takes the remaining seconds away from the total movie length and divides by 60 to turn the seconds into minutes.
22
+
// It takes the remaining seconds away from the total movie length and divides by 60 to turn the seconds into minutes.
23
23
24
24
// e) What do you think the variable result represents? Can you think of a better name for this variable?
25
-
// - It represents the movie duration in hours, minutes, and seconds.
26
-
// - const movieDuration
25
+
// - It represents the movie duration in hours, minutes, and seconds.
26
+
// - const movieDuration
27
27
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
28
-
// The code works with positive whole numbers for movieLength and changes them into hours, minutes, and seconds. Decimal or negative numbers may not give the correct result.
28
+
// The code works with positive whole numbers for movieLength and changes them into hours, minutes, and seconds. Decimal or negative numbers may not give the correct result.
Copy file name to clipboardExpand all lines: Sprint-2/4-stretch-explore/chrome.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,15 @@ Let's try an example.
8
8
In the Chrome console, invoke the function `alert` with one argument, the string `"Hello world!"`;
9
9
10
10
What effect does calling the `alert` function have?
11
+
11
12
- A popup with chrome:/new-tab-page says "hello world"
12
13
13
14
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`.
14
15
15
16
What effect does calling the `prompt` function have?
17
+
16
18
- A popup with chrome:/new-tab-page says "What is your name?" with a text box to type your name.
0 commit comments