Learn about working on JavaScript properties

As a JavaScript developer, all of us knows that JavaScript properties are considered as the most important part of any JavaScript object.
Here, we are going to explain everything you need to know about JavaScript properties.
By reading this out, you will be able to understand the role of JavaScript properties in a code.

JavaScript Properties:

First of all, we are going to share the basics of a JavaScript properties.
The properties in this programming language are the values which are associated to an object used in a program. On the other hand, we can also say that a JavaScript object is a collection of order less properties.
Most of these properties are those which you can add, change or else delete.
But, some of these properties can only be read by the developer.

Syntax of JavaScript properties:

Now, we are going to shed some light on the syntax used for the JavaScript properties.
In order to access the property of an object:

objectName.property          // person.height


objectName["property"]       // person["height "]


objectName[expression]       // x = " height "; person[x]

The expression must evaluate to a property name.


person.firstname + " is " + person. height + " tall.";

Attributes of property:

As you have learned about the syntax of JavaScript properties.
Now, we are going to share the attributes of a property.
First of all, each and every property has a name.
In addition to that, they have a value which is their identity.
The value which is given to the property is also its attribute.
The property of an object is configurable, enumerable as well as writable.
The attributes play an important role in defining how to access the property.
For instance, we have to check whether the property is readable or else it is writable.
Here, we would like to add that all the attributes in this programming language are readable.
But, we can change the value attribute on the condition that the property is writeable.

Properties of prototype:

It is a fact that the JavaScript objects are used to look at their prototypes when it comes to inherit the properties.
Now, if you are thinking about getting rid of them through delete keyword, then it is totally useless.
On the other hand, if you delete the property of a prototype, then you will be able to handle the inherited prototypes.
You can also add new properties to them.



Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?