DEV Community

Discussion on: Classes in JavaScript

Collapse
jakeb1090 profile image
jakeb1090

Sometimes I see properties declared inside the constructor and methods on the outside. What is the difference between declaring methods within the constructor vs outside the constructor?

Collapse
ericdecol profile image
punk croc

Bad code. It should be outsite for organization. You can call it inside the constructor if you want it to run when instantiating a class, but it's creationg should be elsewhere, in a more organized way