You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ var x; // declaring x
24
24
console.log(x); // output: undefined
25
25
```
26
26
27
-
`var x = 1` is both declaration and definition (also we can say we are doing initialisation), Here declaration and assignment of value happen inline for variable x, In JavaScript every variable declaration and function declaration brings to the top of its current scope in which it's declared then assignment happen in order this term is called `hoisting`.
27
+
`var x = 1` is both declaration and definition (what we are doing is called "initialisation"), Here declaration and assignment of value happen inline for variable x, In JavaScript both variable declarations and function declarations go to the top of the scope in which they are declared, then assignment happens—this series of events is called `hoisting`.
28
28
29
29
A variable can be declared but not defined. When we try to access it, It will result `undefined`.
30
30
@@ -644,7 +644,7 @@ The `typeof` operator checks if a value belongs to one of the seven basic types:
644
644
645
645
`typeof(null)` will return `object`.
646
646
647
-
`instanceof` is much more intelligent: it works on the level of prototypes. In particular, it tests to see if the right operand appears anywhere in the prototype chain of the left. `instanceof` doesn’t work with primitive types. It`instanceof` operator checks the current object and returns true if the object is of the specified type, for example:
647
+
`instanceof` is much more intelligent: it works on the level of prototypes. In particular, it tests to see if the right operand appears anywhere in the prototype chain of the left. `instanceof` doesn’t work with primitive types. The`instanceof` operator checks the current object and returns true if the object is of the specified type, for example:
648
648
649
649
```javascript
650
650
var dog =newAnimal();
@@ -674,11 +674,11 @@ counterArray["C"] = 1;
674
674
```
675
675
<details><summary><b>Answer</b></summary>
676
676
677
-
First of all, in case of JavaScript an associative array is the same as an object. Secondly, even though is no built-in function or property available to calculate the length/size an object, we can write such function ourselves.
677
+
First of all, in the case of JavaScript an associative array is the same as an object. Secondly, even though there is no built-in function or property available to calculate the length/size an object, we can write such function ourselves.
678
678
679
679
#### Method 1
680
680
681
-
`Object` has `keys` method which can we used to calculate the length of object.
681
+
`Object` has `keys` method which can be used to calculate the length of object.
0 commit comments