Skip to content

Commit 0688923

Browse files
debug2604debug2604
authored andcommitted
Answered and reflected in chrome.md and object.md
1 parent 83a6fa1 commit 0688923

2 files changed

Lines changed: 40 additions & 31 deletions

File tree

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
Open a new window in Chrome, right click an empty space on the page, select **Inspect** from the dropdown, then locate the **Console** tab.
2-
3-
Voila! You now have access to the [Chrome V8 Engine](https://www.cloudflare.com/en-gb/learning/serverless/glossary/what-is-chrome-v8/).
4-
Just like the Node REPL, you can input JavaScript code into the Console tab and the V8 engine will execute it.
5-
6-
Let's try an example.
7-
8-
In the Chrome console, invoke the function `alert` with one argument, the string `"Hello world!"`;
9-
10-
What effect does calling the `alert` function have?
11-
12-
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`.
13-
14-
What effect does calling the `prompt` function have?
15-
What is the return value of `prompt`?
1+
Open a new window in Chrome, right click an empty space on the page, select **Inspect** from the dropdown, then locate the **Console** tab.
2+
3+
Voila! You now have access to the [Chrome V8 Engine](https://www.cloudflare.com/en-gb/learning/serverless/glossary/what-is-chrome-v8/).
4+
Just like the Node REPL, you can input JavaScript code into the Console tab and the V8 engine will execute it.
5+
6+
Let's try an example.
7+
8+
In the Chrome console, invoke the function `alert` with one argument, the string `"Hello world!"`;
9+
10+
What effect does calling the `alert` function have?
11+
(The function prompts an alert when pressing enter to run)
12+
13+
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+
What effect does calling the `prompt` function have?
16+
(The'prompt'function opens a caveat dialog box, allows user to key in response. )
17+
What is the return value of `prompt`?
18+
(prompt(myName) will return value entered by user)
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
## Objects
2-
3-
In this activity, we'll explore some additional concepts that you'll encounter in more depth later on in the course.
4-
5-
Open the Chrome devtools Console, type in `console.log` and then hit enter
6-
7-
What output do you get?
8-
9-
Now enter just `console` in the Console, what output do you get back?
10-
11-
Try also entering `typeof console`
12-
13-
Answer the following questions:
14-
15-
What does `console` store?
16-
What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean?
1+
## Objects
2+
3+
In this activity, we'll explore some additional concepts that you'll encounter in more depth later on in the course.
4+
5+
Open the Chrome devtools Console, type in `console.log` and then hit enter
6+
7+
What output do you get?
8+
9+
(ƒ log() { [native code] })
10+
11+
Now enter just `console` in the Console, what output do you get back?
12+
(console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …})
13+
14+
Try also entering `typeof console`
15+
('object')
16+
Answer the following questions:
17+
18+
What does `console` store?
19+
(`console` stores an object. Note for question: where is this object source from?)
20+
What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean?
21+
(`log` is a method to print object belongs to console. The `.` access that object stored in `console`)
22+
(`assert`checks if a condition is true.)

0 commit comments

Comments
 (0)