javascript function oop code example
Example 1: js oop
var salva = createNewPerson('Salva');
salva.name;
salva.greeting();
Example 2: is javascript object oriented
var js = new JavaScript();
js.isObjectOrientated = true;
Example 3: oop javascript
function DogObject(name, age) {
let dog = Object.create(constructorObject);
dog.name = name;
dog.age = age;
return dog;
}
let constructorObject = {
speak: function(){
return "I am a dog"
}
}
let bingo = DogObject("Bingo", 54);
console.log(bingo);