Skip to content

Commit 46171e4

Browse files
last question return value of prompt amended
1 parent ae3854e commit 46171e4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Sprint-1/4-stretch-explore/chrome.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ In the Chrome console,
1111
invoke the function `alert` with an input string of `"Hello world!"`;
1212

1313
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.
1515

1616
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`.
1717

1818
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
2021

2122
What is the return value of `prompt`?
2223

2324
Using:
2425
const myName = prompt("What is your name?");
25-
console.log(myName);
26+
myName;
2627

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
2829

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
3031

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
33+
(in this case Hayriye) is returned

0 commit comments

Comments
 (0)