Docs shorthand object notation (#4356)
* Docs shorthand object notation A simple but slightly more imaginative example of shorthand object notation. Closes #1808. Signed-off-by: Daniel Bayley <daniel.bayley@me.com> * Update for new documentation folder structure * Fix typo
This commit is contained in:
parent
cc3be717a0
commit
6c759d49bd
|
@ -0,0 +1,5 @@
|
||||||
|
name = "Michelangelo"
|
||||||
|
mask = "orange"
|
||||||
|
weapon = "nunchuks"
|
||||||
|
turtle = {name, mask, weapon}
|
||||||
|
output = "#{turtle.name} wears an #{turtle.mask} mask. Watch out for his #{turtle.weapon}!"
|
|
@ -457,6 +457,11 @@ Block
|
||||||
about it (say, when using jQuery).
|
about it (say, when using jQuery).
|
||||||
</p>
|
</p>
|
||||||
<%= codeFor('objects_reserved') %>
|
<%= codeFor('objects_reserved') %>
|
||||||
|
<p>
|
||||||
|
CoffeeScript has a shortcut for creating objects when you want the key
|
||||||
|
to be set with a variable of the same name.
|
||||||
|
</p>
|
||||||
|
<%= codeFor('objects_shorthand') %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span id="lexical-scope" class="bookmark"></span>
|
<span id="lexical-scope" class="bookmark"></span>
|
||||||
|
|
Loading…
Reference in New Issue