Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a278045

Browse files
committed
.
1 parent be8c55d commit a278045

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

week2js/3tada15_17.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,8 @@ console.log(o3); // yes o3 has been changed//
3131

3232
// 17. type of//
3333
let bar = 42;
34-
console.log(typeof typeof bar);
35-
console.log(typeof bar);
34+
console.log(typeof typeof bar); //returns 'string' because the word number is a string?//
35+
console.log(typeof bar); //returns 'number' because the value of bar is 42 which is a number//
3636
console.log(bar);
3737

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-
45-
46-
4738

0 commit comments

Comments
 (0)