mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Fix constructor_destructuring example to alert a defined value
This commit is contained in:
parent
40c1086efa
commit
26c0f7ca2d
3 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue