function Person(name){
this.getName = function(){
return name;
}
this.setName = function(value){
name = value;
};
}
var person = new Person("Nicholas");
alert(person.getName());
person.setName("Greg");
alert(person.getName());
(function(){
var name ="";
Person = function(value){
name = value;
};
Person.prototype.getName = function(){
return name;
};
Person.prototype.setName = function(value){
name = value;
};
})();
var person1 = new Person("Nicholas");
alert(person1.getName());
person1.setName("Greg");
alert(person1.getName());
var person2 = new Person("Michael");
alert(person1.getName());
alert(person2.getName());
console