Closed Eldar-X closed 7 years ago
Destructuring can only be used where data is "received", primarily the left hand side of an assignment. You can use destructuring by simply doing constructor ({name, age = 0})
which, when fed an Object that has properties of .name
and .age
(defaulting to 0) it will create variables of those names. I'm assuming that's what you were aiming for here?
What you have written right now is likely being interpreted as a destructuring assignment like above, but with a default value of args
(which isn't defined).
This has nothing to do with standard
, or linter-js-standard
though 😛, other than them telling you about this bug.
you are right it's my bad 😃
I got error message "args is not defined" when try to make this
module.exports = class People { constructor ({name, age = 0} = args) { this.name = name this.age = age } }
Even when i set parser (babel-eslint / esprima) in package.json i don't see any changes