Skip to content

Commit 924741c

Browse files
committed
docs: testing and documentation on how works console log and assert.
1 parent 1795109 commit 924741c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Sprint-1/explore/objects.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,50 @@ In this activity, we'll explore some additional concepts that you'll encounter i
44

55
Open the Chrome devtools Console, type in `console.log` and then hit enter
66

7+
console.log
8+
ƒ log() { [native code] }
9+
Explanation:
10+
This output indicates that console.log is a function provided by the browser (native code). You are seeing the function itself, not executing it.
11+
12+
713
What output do you get?
814

915
Now enter just `console` in the Console, what output do you get back?
1016

17+
console
18+
and press Enter, the Console shows something like:
19+
20+
console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …}
21+
Explanation:
22+
This output shows that console is an object containing multiple methods, such as:
23+
24+
* log
25+
* error
26+
* warn
27+
* info
28+
* debug
29+
30+
Each of these properties is a function that can be used to output messages to the Console in different ways.
31+
1132
Try also entering `typeof console`
1233

34+
typeof console
35+
'object'
36+
1337
Answer the following questions:
1438

1539
What does `console` store?
1640
What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean?
41+
42+
console is an object
43+
44+
It stores methods (functions)
45+
46+
. is used to access properties or methods on an object
47+
48+
log / assert → a property of console (in this case, a function)
49+
50+
console stores an object.
51+
This object contains properties and methods (mostly functions) provided by the browser for debugging, such as log, error, warn, info, and assert.
52+
53+

0 commit comments

Comments
 (0)