Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs shorthand object notation #4356

Merged
merged 4 commits into from
Nov 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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