“classes are a poor mans clojure” I think it’s from the tao of programming book. But i agree with it in case of JS, since it doesn’t have classes in the same way C# or Java do, you can just use closures when you need to keep state and have functions work on it.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
“classes are a poor mans clojure” I think it’s from the tao of programming book. But i agree with it in case of JS, since it doesn’t have classes in the same way C# or Java do, you can just use closures when you need to keep state and have functions work on it.
I recall it goes
but the key point to the statement is it can be reversed, hence
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.