I'm having a object where I've one property called "country" as Ireland. I want to prevent the developer to update the property when he tries to update in the code level. Is there any chance of doing it? If so, please let me know
var Car = function() {
this.init();
return this;
}
Car.prototype = {
init : function() {
},
country: "Ireland",
}
var c = new Car();
c.country = 'England';
I dont want country to be set to any other value other than Ireland. I can do this by checking with if condition. Instead of if conditions, can I have any other way?