DEV Community

Discussion on: Classes in JavaScript

jakeb1090 profile image

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?

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