1function Person(name) {
2 this.name = name;
3 this.greeting = function() {
4 alert('Hi! I\'m ' + this.name + '.');
5 };
6}
1let names = {
2 fname: "Dillion",
3 lname: "Megida"
4}
5console.log(names.fname);
6console.log(names.hasOwnProperty("mname"));
7// Expected Output
8// Dillion
9// false
10
1function DogObject(name, age) {
2 let dog = Object.create(constructorObject);
3 dog.name = name;
4 dog.age = age;
5 return dog;
6}
7let constructorObject = {
8 speak: function(){
9 return "I am a dog"
10 }
11}
12let bingo = DogObject("Bingo", 54);
13console.log(bingo);
14