Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d500a3 commit be8c55dCopy full SHA for be8c55d
week2js/3tada15_17.js
@@ -30,8 +30,15 @@ console.log(o2);
30
console.log(o3); // yes o3 has been changed//
31
32
// 17. type of//
33
-let bar = 42; // typeof bar would return number//
34
-console.log(typeof typeof bar); // returns string//
+let bar = 42;
+console.log(typeof typeof bar);
35
+console.log(typeof bar);
36
+console.log(bar);
37
+
38
+// 42 is a primitive (ie because it is a number). so you cannot get a typeof of it usually as it has no property.
39
+//but in order to get a typeof, it is temporarily coerced into being an object.
40
+//so then it can return a value ie string (line 34) or number (line 35)
41
+//the created object is then removed into the garbage.
42
43
44
0 commit comments