DEV Community


Discussion on: I Don't Use JavaScript Classes At All. Am I Missing Out on Something?

sebring profile image
J. G. Sebring

I recall it goes

"objects are merely a poor man's closures"

but the key point to the statement is it can be reversed, hence

"closures merely a poor man's object"

andi23rosca profile image
Andi Rosca

Yeah true. In some ways objects can be considered better since they have more functionality attached to them, but in JS to me at least they’re pretty much the same thing.

I prefer closures since JS doesn’t have private properties on classes but you can choose not to return things from a closure and keep them private in a sense.