_x000D_
//new way using this and new_x000D_
function Persons(name) {_x000D_
this.name = name;_x000D_
this.greeting = function() {_x000D_
alert('Hi! I\'m ' + this.name + '.');_x000D_
};_x000D_
}_x000D_
_x000D_
var gee=new Persons("gee");_x000D_
gee.greeting();_x000D_
_x000D_
var gray=new Persons("gray");_x000D_
gray.greeting();_x000D_
_x000D_
//old way_x000D_
function createPerson(name){_x000D_
var obj={};_x000D_
obj.name=name;_x000D_
obj.greeting = function(){_x000D_
console.log("hello I am"+obj.name);_x000D_
}; _x000D_
return obj;_x000D_
}_x000D_
_x000D_
var gita=createPerson('Gita');_x000D_
gita.greeting();
_x000D_