Hi Nathan, thanks for the comment and for analyzing the example a little further.

I agree that for the given example changing the code like you did does work and gives you the option to reduce one line on the consumer function. However now that object you created is prone to confusion and error. I'm not so sure I'd like to see that reference of `article` inside `article`. Seems wrong.

Look at the following example based out of your code:


const article2 = { ...article }



What do you think would happen? Not what you expect. Our new object article2 seems to be a copy of article, however, since inside the clap function you reference `article` and not `this`, everytime `article2.clap()` gets called you end up changing `article.claps` and its super weird.

I'd be a bit careful when doing that kind of assignments.

And as to the `++` syntax, I agree, it's less clear, but old habits die hard! I should probably work on that a bit better.

Thanks again!

I’m an entrepreneur, developer, author, speaker, and doer of things. I write about JavaScript, Python, AI, and programming in general.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store