js oop
function Person(name) {
this.name = name;
this.greeting = function() {
alert('Hi! I\'m ' + this.name + '.');
};
}
js oop
function Person(name) {
this.name = name;
this.greeting = function() {
alert('Hi! I\'m ' + this.name + '.');
};
}
is javascript object oriented
var js = new JavaScript();
js.isObjectOrientated = true;
js oop
var salva = createNewPerson('Salva');
salva.name;
salva.greeting();
oops in javascript
const book = { title: "Hippie", author: "Paulo Coelho", year: "2018"}
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);
oop javascript
class Beluga {
constructor(name, job, age, hobby) {
this.name = name;
this.job = job;
this.age = age;
this.hobby = hobby;
}
}
var beluga = new Beluga("Beluga", "Web Developer", 34, "Bowling")
// Expected output is Web Developer
console.log(beluga.job)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us