So, JavaScript can be a bit confusing when you're learning Object-Oriented Programming (OOP). At first, it wasn't really an object-oriented language. Instead, it started with just objects that were essentially simple collections of key-value pairs. This means that objects in JavaScript were originally just a way to store data (like { name: 'John', lastName: 'Doe' }), with no built-in way to define behaviors or methods that the object could perform.
In your example, the person object is just a collection of properties (name, lastName, etc.), with no functions attached to it. It's like a data container, not something that has actions it can do.
Later, JavaScript introduced classes, which are like blueprints for creating these objects but with additional features. A class allows you to define both data (attributes) and behavior (methods) together. So instead of just having a simple object that stores data, a class lets you create objects that can also do things, like a greet() method that prints a message based on the object’s attributes.
So, when you’re learning OOP in JavaScript, it can get confusing because it started out as just key-value pairs, and only later introduced classes to formalize the OOP structure.