Skip to content

Commit 38c371d

Browse files
author
lintsang
committed
Finished all exercises in 4-stretch-explore folder
1 parent 6f1e671 commit 38c371d

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ Let's try an example.
1010
In the Chrome console,
1111
invoke the function `alert` with an input string of `"Hello world!"`;
1212

13+
Answer: A modal window pop up showing Hello World! on it.
14+
1315
What effect does calling the `alert` function have?
1416

17+
Answer: When the modal window pop up, user would see message "Hello World!" and has to click OK on the window.
18+
1519
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`.
1620

1721
What effect does calling the `prompt` function have?
22+
23+
Answer: A modal window pop up showing a question 'What is your name?' on it and a input field in shown under it for user to insert the name.
24+
1825
What is the return value of `prompt`?
26+
27+
Answer: 'Undefined' is shown in the return value.

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@ Open the Chrome devtools Console, type in `console.log` and then hit enter
66

77
What output do you get?
88

9+
Answer: 'ƒ log() { [native code] }' is shown.
10+
911
Now enter just `console` in the Console, what output do you get back?
1012

13+
Answer: I got 'console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …}'.
14+
1115
Try also entering `typeof console`
1216

17+
Answer: 'object'.
18+
1319
Answer the following questions:
1420

1521
What does `console` store?
22+
23+
Answer: 'Console' stores the varaiables we declared temporarily until we refresh the page.
24+
1625
What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean?
26+
27+
Both of it has the syntax XXX.XXX at the front is the object and after dot is the method called. So now I know console is the built-in browser object. The dot is the Member Access Operator which make connection or indication between the object and method.

0 commit comments

Comments
 (0)