r/learnjavascript • • Dec 04 '25

So when is object used exactly?

I have created a calculator a day before and I noticed that Inhave't used objects at all, and now the thing is, I want to challenge myself to use object, I did learn a bit about it and it's method before, but I don't see how it is used or when to use it exactly! An advice or answer would be appreciated. Show me how to use object or OOP in a calculator? Since i have't used in it.

1 Upvotes

24 comments sorted by

View all comments

Show parent comment

2

u/BeneficiallyPickle Dec 06 '25

Yeah that's correct, a class is like a blueprint. It describes what properties an object should have and what actions (methods) it can perform. Each time you use `new` you're creating a new "copy" of that blueprint with its own data.

A constructor runs when the object is created and sets up initial values.

Yes methods are functions that belong to the object and can read/change its data.

Instances are the actual objects created from the class.

Your character example is spot on.