|
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) |
0 commit comments