|
1 | 1 | ## Objects |
2 | 2 |
|
3 | | -In this activity, we'll explore some additional concepts that you'll encounter in more depth later on in the course. |
| 3 | +//In this activity, we'll explore some additional concepts that you'll encounter in more depth later on in the course. |
4 | 4 |
|
5 | | -Open the Chrome devtools Console, type in `console.log` and then hit enter |
| 5 | +//Open the Chrome devtools Console, type in `console.log` and then hit enter |
6 | 6 |
|
7 | | -What output do you get? |
| 7 | +// What output do you get? |
| 8 | +// ƒ (){for(var o=arguments.length,u=new Array(o),l=0;l<o;l++)u[l]=arguments[l];if(e.apply(n,u),!("assert"===r&&u[0]||a)){a=!0;try{var |
| 9 | +// d=Di.parse(new Error).map((t=>t.toString())).splice(1),c=("assert"===… |
8 | 10 |
|
9 | | -Now enter just `console` in the Console, what output do you get back? |
| 11 | +//Now enter just `console` in the Console, what output do you get back? |
| 12 | +// console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …} |
10 | 13 |
|
11 | | -Try also entering `typeof console` |
| 14 | +//Try also entering `typeof console` |
| 15 | +//Answer the following questions: |
| 16 | +//What does `console` store? |
| 17 | +//The console in JavaScript doesn’t store the program’s variables or data — instead, it’s an object provided by the browser (or Node.js) that contains a set of methods for |
| 18 | +//logging information, debugging, and interacting with the JavaScript environment. |
12 | 19 |
|
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? |
| 20 | +//What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? |
| 21 | +//In both cases, console is an object, and log or assert are properties (specifically, methods) of that object. The dot (.) is called the dot notation operator or member |
| 22 | +//access operator. It is used in JavaScript (and many other languages) to access a property or method that belongs to an object. |
0 commit comments