Why is the "setter defined without getter" JSHint error?

Jsfiddle link

var obj = {
  set bla(k) {
    console.log(k);
  }
};

JSHint refers to this as "setter defined without getter". I am sure there is a way to disable this, but why is this a mistake at all? All that I saw, the JSHint flag had a reasonable explanation. I can’t think of why this is bad.

+4
source share
2 answers

, JSHint . (http://www.ecma-international.org/publications/standards/Ecma-262.htm, . 30-31), , , , , . , . .

JSHint .

+6

, , , . . , , , , . foo == null - , , .

+1

Source: https://habr.com/ru/post/1538805/


All Articles