Updating documentation for has own key, value

This commit is contained in:
Jeremy Ashkenas 2010-12-21 18:57:23 -05:00
parent 72e5c4300c
commit 80693d8338
2 changed files with 8 additions and 10 deletions

View File

@ -564,11 +564,10 @@ coffee --bare --print --stdio</pre>
</p>
<%= code_for('object_comprehensions', 'ages.join(", ")') %>
<p>
By default, object comprehensions are safe, and use a <tt>hasOwnProperty</tt>
check to make sure that you're dealing with properties on the current
object. If you'd like the regular JavaScript <br /><tt>for (key in obj) ...</tt>
loop, for speed or for another reason, you can use <br />
<tt>for all key, value of object</tt> in CoffeeScript.
If you would like to iterate over just the keys that are defined on the
object itself, by adding a <tt>hasOwnProperty</tt>
check to avoid properties that may be interited from the prototype, use<br />
<tt>for own key, value of object</tt>
</p>
<p>
<span id="slices" class="bookmark"></span>

View File

@ -973,11 +973,10 @@ ages = function() {
return _results;
}();;alert(ages.join(", "));'>run: ages.join(", ")</div><br class='clear' /></div>
<p>
By default, object comprehensions are safe, and use a <tt>hasOwnProperty</tt>
check to make sure that you're dealing with properties on the current
object. If you'd like the regular JavaScript <br /><tt>for (key in obj) ...</tt>
loop, for speed or for another reason, you can use <br />
<tt>for all key, value of object</tt> in CoffeeScript.
If you would like to iterate over just the keys that are defined on the
object itself, by adding a <tt>hasOwnProperty</tt>
check to avoid properties that may be interited from the prototype, use<br />
<tt>for own key, value of object</tt>
</p>
<p>
<span id="slices" class="bookmark"></span>