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
function call that is preceded by the <code>new</code> keyword acts as a constructor.</p>
742
745
743
746
<p>Inside the constructor - the called function - the value of <code>this</code> refers to a
744
-
newly created <code>Object</code>. The <ahref="#object.prototype"><code>prototype</code></a> of this <strong>new</strong>
747
+
newly created object. The <ahref="#object.prototype">prototype</a> of this <strong>new</strong>
745
748
object is set to the <code>prototype</code> of the function object that was invoked as the
746
749
constructor.</p>
747
750
@@ -869,7 +872,7 @@ <h2>License</h2>
869
872
especially important to choose a specific style of object creation <strong>and stick</strong>
870
873
with it.</p></div></article><articleid="function.scopes"><h2>Scopes and Namespaces</h2><div><p>Although JavaScript deals fine with the syntax of two matching curly
871
874
braces for blocks, it does <strong>not</strong> support block scope; hence, all that is left
872
-
is in the language is <em>function scope</em>.</p>
875
+
in the language is <em>function scope</em>.</p>
873
876
874
877
<pre><code>function test() { // a scope
875
878
for(var i = 0; i < 10; i++) { // not a scope
@@ -1096,12 +1099,14 @@ <h2>License</h2>
1096
1099
() // call the result of the evaluation
1097
1100
</code></pre>
1098
1101
1099
-
<p>There are other ways for evaluating and calling the function expression; which,
1102
+
<p>There are other ways for evaluating and directly calling the function expression; which,
1100
1103
while different in syntax, do behave the exact same way.</p>
1101
1104
1102
-
<pre><code>// Two other ways
1103
-
+function(){}();
1105
+
<pre><code>// A few other styles for directly invoking the
1106
+
!function(){}()
1107
+
+function(){}()
1104
1108
(function(){}());
1109
+
// and so on...
1105
1110
</code></pre>
1106
1111
1107
1112
</div><div><h3>In Conclusion</h3>
@@ -1536,11 +1541,13 @@ <h2>License</h2>
1536
1541
1537
1542
<ul>
1538
1543
<li>Accessing the (unmodified) global variable <code>undefined</code>.</li>
1544
+
<li>Accessing a declared <em>but not</em> yet initialized variable</li>
1539
1545
<li>Implicit returns of functions due to missing <code>return</code> statements.</li>
1540
1546
<li><code>return</code> statements which do not explicitly return anything.</li>
1541
1547
<li>Lookups of non-existent properties.</li>
1542
1548
<li>Function parameters which do not had any explicit value passed.</li>
1543
1549
<li>Anything that has been set to the value of <code>undefined</code>.</li>
1550
+
<li>Any expression in the form of <code>void(expression)</code></li>
1544
1551
</ul>
1545
1552
1546
1553
</div><div><h3>Handling Changes to the Value of <code>undefined</code></h3>
0 commit comments