@@ -4,13 +4,55 @@ In this activity, we'll explore some additional concepts that you'll encounter i
44
55Open the Chrome devtools Console, type in ` console.log ` and then hit enter
66
7- What output do you get?
7+ What output do you get?
8+ 1 . it show something like:
9+ ƒ log() { [ native code] }
10+ This tells you that console.log is a function. Specifically, it's a built-in JavaScript function used to print messages to the console.
811
912Now enter just ` console ` in the Console, what output do you get back?
13+ 2 . it show something like this:
14+ console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …}
15+ It shows a list of functions and properties, like log, error, warn, assert, clear, etc.
16+ This tells you that console is a built-in object that stores useful debugging tools.
1017
1118Try also entering ` typeof console `
19+ 3 . it show "object"
20+ This confirms that console is an object in JavaScript.
1221
1322Answer the following questions:
1423
1524What does ` console ` store?
1625What does the syntax ` console.log ` or ` console.assert ` mean? In particular, what does the ` . ` mean?
26+
27+
28+
29+
30+ Answering the Questions:
31+ 1 . What does console store?
32+ console is a JavaScript object that contains methods (functions) used mainly for debugging.
33+
34+ It stores functions like:
35+
36+ console.log() – logs messages
37+
38+ And others like console.clear(), console.table(), etc.
39+
40+ 2 . What does console.log or console.assert mean?
41+ These are method calls on the console object.
42+
43+ console.log means: access the log property (a function) that is stored inside the console object.
44+
45+ console.log() means: call that function.
46+
47+ console.assert() is similar but only logs when a condition is false.
48+
49+ 3 . What does the . (dot) mean in JavaScript?
50+ The dot is the member access operator.
51+
52+ It means: "get the property named X from this object".
53+
54+ So:
55+
56+ console.log → get the log function from the console object.
57+
58+ console.log("sami") → run the log function with the argument "sami".
0 commit comments