JS Linting the following bit of code:
/*jslint
browser: true,
es5: true,
*/
var VCA = {
get enable () {
'use strict';
return 0;
},
set enable (value) {
'use strict';
console.log(value);
}
};
Results in the error:
Problem at line 11 character 9: Expected 'set' and instead saw ''.
set enable (value) {
I don’t understand what to do to make this see 'set' correctly?!
I know about the __defineGetter__ syntax but really want to use the above style.
Does anyone have more information on this error?
It seems to be a problem in JSLint. I can’t get any get/set scenario to validate in JSLint. Your syntax seems to be right, and in line with Douglas’ initial post about getter setter validation.
edit: this validates fine, so might be a workaround 🙂