Skip to content

destructuring parameters currently undocumented #1607

@timoxley

Description

@timoxley

The destructuring parameter lists syntax isn't mentioned in the docs anywhere, and the syntax is really neat:

class Man
    constructor: ({@name, @description}) ->
        # empty constructor. is magic.
        # note the curly braces

# note the use of a named parameter list on initialisation    
dave = new Man
    name: 'Dave'
    description: 'a dude'

console.log "#{dave.name} is #{dave.description}" # output: Dave is a dude

Recommend adding to documentation.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions