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.
1919Some examples for when the value ` undefined ` is returned:
2020
2121 - Accessing the (unmodified) global variable ` undefined ` .
22+ - Accessing a declared * but not* yet initialized variable
2223 - Implicit returns of functions due to missing ` return ` statements.
2324 - ` return ` statements which do not explicitly return anything.
2425 - Lookups of non-existent properties.
2526 - Function parameters which do not had any explicit value passed.
2627 - Anything that has been set to the value of ` undefined ` .
28+ - Any expression in the form of ` void(expression) `
2729
2830### Handling Changes to the Value of ` undefined `
2931
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
44function call that is preceded by the ` new ` keyword acts as a constructor.
55
66Inside 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**
88object is set to the ` prototype ` of the function object that was invoked as the
99constructor.
1010
Original file line number Diff line number Diff line change 22
33Although JavaScript deals fine with the syntax of two matching curly
44braces 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* .
66
77 function test() { // a scope
88 for(var i = 0; i < 10; i++) { // not a scope
@@ -213,12 +213,14 @@ being callable, they must first be evaluated.
213213 ) // and return the function object
214214 () // call the result of the evaluation
215215
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,
217217while different in syntax, do behave the exact same way.
218218
219- // Two other ways
220- +function(){}();
219+ // A few other styles for directly invoking the
220+ !function(){}()
221+ +function(){}()
221222 (function(){}());
223+ // and so on...
222224
223225### In Conclusion
224226
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.
4444 // Use another Object's hasOwnProperty and call it with 'this' set to foo
4545 ({}).hasOwnProperty.call(foo, 'bar'); // true
4646
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+
4751### In Conclusion
4852
4953When checking for the existence of a property on a object, ` hasOwnProperty ` is
You can’t perform that action at this time.
0 commit comments