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
Copy file name to clipboardExpand all lines: Sprint-1/4-stretch-explore/chrome.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,21 +11,23 @@ In the Chrome console,
11
11
invoke the function `alert` with an input string of `"Hello world!"`;
12
12
13
13
What effect does calling the `alert` function have?
14
-
a pop up box appears saying thecharitych.com says this is an alert
14
+
A pop up box appears saying thecharitych.com says this is an alert, the function returns undefined.
15
15
16
16
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`.
17
17
18
18
What effect does calling the `prompt` function have?
19
-
a pop up box appears saying thecharitych.com says What is your name
19
+
A pop up box appears saying thecharitych.com says What is your name
20
+
with the options to complete name, press ok or press cancel
20
21
21
22
What is the return value of `prompt`?
22
23
23
24
Using:
24
25
const myName = prompt("What is your name?");
25
-
console.log(myName);
26
+
myName;
26
27
27
-
If I click ok without entering my name the prompt goes off the screen and console.log returns undefined
28
+
If I click ok without entering my name the prompt goes off the screen and an empty string ("") is returned
28
29
29
-
If I click cancel without entering my name the promptgoes off the screen and console.log null undefined
30
+
If I click cancel without entering my name the prompt goes off the screen and null is returned
30
31
31
-
If I put my name Hayriye in and click ok then it goes off the screen and console.log returns Hayriye
32
+
If I put my name Hayriye in and click ok then it goes off the screen and a string containing the users input
0 commit comments