JavaScript and Objects
Explore the fundamentals of JavaScript objects including what objects are, how to create them using object literals, and how to access and modify their properties. Understand how object-oriented programming organizes code around objects rather than procedures, helping you write more structured and flexible JavaScript.
What’s an object?
Think about objects in the non-programming sense, just like tangible things we see around us. Take an example of a pen. A pen can have different ink colors, be manufactured by different people, have a different tip, and have many other properties.
Similarly, an object in programming is an entity that has properties. Each property defines a characteristic of the object. A property can be a piece of information associated with the object (the color of the pen) or an action (the pen’s ability to write).