Skip to content

Setter default value #7688

@nikolayemrikh

Description

@nikolayemrikh

Default value in setter argument causes an error:

const obj = {
	set field(num = 1) {this._num = num;},
	get field() {return this._num;}
};

Got unhandled error setter should have exactly one param, cause setter transpiled as:

set field() {
	var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
	this._num = num;
}

And it hasn't any argument.

Perfectly works in chrome without transpiling:

2018-04-07 22 33 29

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions