Hi there ! I have a question
Lets create an object
const circle = {
radius: 1
};
While declaring and object with ‘const’, we don’t use let or const with object propoerties so what is with the property ? i.e. const radius or let radius ?
There is one more question.
After declaring an object with Constructor Function, how can we assign or remove a property as constructor function include this keyword. How can we assign or remove outside constructor function
You can change the properties after object creation.
In a constructor function you need this to reference the object just created. As soon as you have a reference to the object
const myCircle = new Circle(1);
You can use that instead to modify myCircle.radius = 5; add myCircle.color = "red"; or delete remove myCircle.color; a property (although I don’t think it’s a good idea to add or remove properties in OOP).