Skip to content

Commit

Permalink
Docs shorthand object notation (#4356)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
danielbayley authored and GeoffreyBooth committed Nov 21, 2016
1 parent cc3be71 commit 6c759d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions documentation/examples/objects_shorthand.coffee
Original file line number Diff line number Diff line change
@@ -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}!"
5 changes: 5 additions & 0 deletions documentation/index.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ Block
about it (say, when using jQuery).
</p>
<%= 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>
<span id="lexical-scope" class="bookmark"></span>
Expand Down

0 comments on commit 6c759d4

Please sign in to comment.