Skip to content

Commit 48d4945

Browse files
authored
Answered both questions.
Clarify the effects and return values of alert and prompt functions.
1 parent ec4e15c commit 48d4945

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ invoke the function `alert` with an input string of `"Hello world!"`;
1212

1313
What effect does calling the `alert` function have?
1414

15+
1. This function displays a pop-up box with Hello world written on it, with on OK button.
16+
1517
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`.
1618

1719
What effect does calling the `prompt` function have?
20+
21+
2. It displays a pop-up box with What's your name written on it and an empty dialog box inside, awaiting my input.
22+
Also, there are two options of OK and Cancel.
23+
1824
What is the return value of `prompt`?
25+
26+
3. If I enter my name undefined appears, same if i press the cancel button. Fixed this by adding myName at the end.
27+
Now the value when i enter my name shows "my name", if i press cancel it shows "null".

0 commit comments

Comments
 (0)