what is oop in javscript code example
Example 1: js oop
function Person(name) {
this.name = name;
this.greeting = function() {
alert('Hi! I\'m ' + this.name + '.');
};
}
Example 2: js oop
var salva = createNewPerson('Salva');
salva.name;
salva.greeting();