Skip to content

Commit

Permalink
Add missing closing parentheses (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavwilliam authored Jan 4, 2021
1 parent 01745fc commit 2fd1f6c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ <h2 id="More_flexible_constructors">More flexible constructors</h2>
<p>The JavaScript logical OR operator (<code>||</code>) evaluates its first argument. If that argument converts to true, the operator returns it. Otherwise, the operator returns the value of the second argument. Therefore, this line of code tests to see if <code>name</code> has a useful value for the <code>name</code> property. If it does, it sets <code>this.name</code> to that value. Otherwise, it sets <code>this.name</code> to the empty string. This chapter uses this idiom for brevity; however, it can be puzzling at first glance.</p>

<div class="note">
<p><strong>Note:</strong> This may not work as expected if the constructor function is called with arguments which convert to <code>false</code> (like <code>0</code> (zero) and empty string (<code>""</code>). In this case the default value will be chosen.</p>
<p><strong>Note:</strong> This may not work as expected if the constructor function is called with arguments which convert to <code>false</code> (like <code>0</code> (zero) and empty string (<code>""</code>)). In this case the default value will be chosen.</p>
</div>

<p>With these definitions, when you create an instance of an object, you can specify values for the locally defined properties. You can use the following statement to create a new <code>Engineer</code>:</p>
Expand Down

0 comments on commit 2fd1f6c

Please sign in to comment.