2021-04-28 16:49:39 +02:00

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;
}
}
----