File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,13 @@ overwritten.
19
19
Some examples for when the value ` undefined ` is returned:
20
20
21
21
- Accessing the (unmodified) global variable ` undefined ` .
22
+ - Accessing a declared * but not* yet initialized variable
22
23
- Implicit returns of functions due to missing ` return ` statements.
23
24
- ` return ` statements which do not explicitly return anything.
24
25
- Lookups of non-existent properties.
25
26
- Function parameters which do not had any explicit value passed.
26
27
- Anything that has been set to the value of ` undefined ` .
28
+ - Any expression in the form of ` void(expression) `
27
29
28
30
### Handling Changes to the Value of ` undefined `
29
31
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Constructors in JavaScript are yet again different from many other languages. An
4
4
function call that is preceded by the ` new ` keyword acts as a constructor.
5
5
6
6
Inside the constructor - the called function - the value of ` this ` refers to a
7
- newly created ` Object ` . The [ ` prototype ` ] ( #object.prototype ) of this ** new**
7
+ newly created object . The [ prototype] ( #object.prototype ) of this ** new**
8
8
object is set to the ` prototype ` of the function object that was invoked as the
9
9
constructor.
10
10
Original file line number Diff line number Diff line change 2
2
3
3
Although JavaScript deals fine with the syntax of two matching curly
4
4
braces for blocks, it does ** not** support block scope; hence, all that is left
5
- is in the language is * function scope* .
5
+ in the language is * function scope* .
6
6
7
7
function test() { // a scope
8
8
for(var i = 0; i < 10; i++) { // not a scope
@@ -213,12 +213,14 @@ being callable, they must first be evaluated.
213
213
) // and return the function object
214
214
() // call the result of the evaluation
215
215
216
- There are other ways for evaluating and calling the function expression; which,
216
+ There are other ways for evaluating and directly calling the function expression; which,
217
217
while different in syntax, do behave the exact same way.
218
218
219
- // Two other ways
220
- +function(){}();
219
+ // A few other styles for directly invoking the
220
+ !function(){}()
221
+ +function(){}()
221
222
(function(){}());
223
+ // and so on...
222
224
223
225
### In Conclusion
224
226
Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ necessary to use an *external* `hasOwnProperty` in order to get correct results.
44
44
// Use another Object's hasOwnProperty and call it with 'this' set to foo
45
45
({}).hasOwnProperty.call(foo, 'bar'); // true
46
46
47
+ // It's also possible use the hasOwnProperty property from the Object property for this purpuse
48
+ Object.prototype.hasOwnProperty.call(obj, 'bar'); // true
49
+
50
+
47
51
### In Conclusion
48
52
49
53
When checking for the existence of a property on a object, ` hasOwnProperty ` is
You can’t perform that action at this time.
0 commit comments