25 lines
464 B
Plaintext
25 lines
464 B
Plaintext
Functions declared with the ``++set++`` keyword will automatically return the values they were passed. Thus any value explicitly returned from a setter will be ignored, and explicitly returning a value is an error.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
var person = {
|
|
// ...
|
|
set name(name) {
|
|
this.name = name;
|
|
return 42; // Noncompliant
|
|
}
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
var person = {
|
|
// ...
|
|
set name(name) {
|
|
this.name = name;
|
|
}
|
|
}
|
|
----
|