JS OOP
var salva = createNewPerson('Salva');
salva.name;
salva.greeting();
Gendzi
var salva = createNewPerson('Salva');
salva.name;
salva.greeting();
function createNewPerson(name) {
var obj = {};
obj.name = name;
obj.greeting = function() {
alert('Hi! I\'m ' + this.name + '.');
};
return obj;
}