mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Merge pull request #3165 from grschafer/master
Fix constructor_destructuring docs example to alert a defined value
This commit is contained in:
@@ -2,3 +2,5 @@ class Person
|
||||
constructor: (options) ->
|
||||
{@name, @age, @height} = options
|
||||
|
||||
tim = new Person age: 4
|
||||
|
||||
|
||||
@@ -805,7 +805,7 @@ Expressions
|
||||
Destructuring assignment is also useful when combined with class constructors
|
||||
to assign properties to your instance from an options object passed to the constructor.
|
||||
</p>
|
||||
<%= code_for('constructor_destructuring', 'contents.join("")') %>
|
||||
<%= code_for('constructor_destructuring', 'tim.age') %>
|
||||
|
||||
<p>
|
||||
<span id="fat-arrow" class="bookmark"></span>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated by CoffeeScript 1.6.3
|
||||
var Person;
|
||||
var Person, tim;
|
||||
|
||||
Person = (function() {
|
||||
function Person(options) {
|
||||
@@ -9,3 +9,7 @@ Person = (function() {
|
||||
return Person;
|
||||
|
||||
})();
|
||||
|
||||
tim = new Person({
|
||||
age: 4
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user