From 6c759d49bde9ba478ab3b98a656c13efb22aa7e8 Mon Sep 17 00:00:00 2001
From: Daniel Bayley
Date: Mon, 21 Nov 2016 07:04:49 +0000
Subject: [PATCH] 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
* Update for new documentation folder structure
* Fix typo
---
documentation/examples/objects_shorthand.coffee | 5 +++++
documentation/index.html.js | 5 +++++
2 files changed, 10 insertions(+)
create mode 100644 documentation/examples/objects_shorthand.coffee
diff --git a/documentation/examples/objects_shorthand.coffee b/documentation/examples/objects_shorthand.coffee
new file mode 100644
index 0000000000..4d3a9e251b
--- /dev/null
+++ b/documentation/examples/objects_shorthand.coffee
@@ -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}!"
diff --git a/documentation/index.html.js b/documentation/index.html.js
index 495201c269..75bf60c954 100644
--- a/documentation/index.html.js
+++ b/documentation/index.html.js
@@ -457,6 +457,11 @@ Block
about it (say, when using jQuery).
<%= codeFor('objects_reserved') %>
+
+ CoffeeScript has a shortcut for creating objects when you want the key
+ to be set with a variable of the same name.
+
+ <%= codeFor('objects_shorthand') %>