Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
week06
  • Loading branch information
hol23003 committed Feb 26, 2024
1 parent 86d8e57 commit c81d0fd
Showing 1 changed file with 25 additions and 44 deletions.
69 changes: 25 additions & 44 deletions week-06/js/script.js
Expand Up @@ -2,65 +2,46 @@ function createPerson(name) {
const obj = {};
obj.name = name;
obj.introduceSelf = function () {
console.log(`Hi! I'm ${this.name}.`);
console.log(`Hi! I'm ${this.name.first}.`);
};
return obj;
}

const person1 = {
name: {
first: "Hongchan",
last: "Lee",
},
age: 30,
eyes: "black",
height: "1.85m",
bio() {
console.log(`${person1.name.first} ${person1.name.last} is ${person1.age} years old.`);
},
introduceSelf() {
console.log(`Hi! I'm ${person1.name.first}.`);
}
const person1 = createPerson({ first: "Hongchan", last: "Lee" });
person1.age = 30;
person1.eyes = "black";
person1.height = "1.85m";
person1.bio = function () {
console.log(`${this.name.first} ${this.name.last} is ${this.age} years old.`);
};

person1.farewell = function () {
console.log("Goodbye everybody!");
};

const person2 = {
name: {
first: "James",
last: "Hush",
},
age: 28,
eyes: "blue",
height: "1.79m",
bio() {
console.log(`${person2.name.first} ${person2.name.last} is ${person2.age} years old.`);
},
introduceSelf() {
console.log(`Hi! I'm ${person2.name.first}.`);
}

const person2 = createPerson({ first: "James", last: "Hush" });
person2.age = 28;
person2.eyes = "blue";
person2.height = "1.79m";
person2.bio = function () {
console.log(`${this.name.first} ${this.name.last} is ${this.age} years old.`);
};

person2.farewell = function () {
console.log("It's time to say Goodbye!");
};

function logProperty(propertyName) {
};
function logProperty(person, propertyName) {
console.log(person[propertyName]);
}

logProperty("name");

logProperty("age");
logProperty(person1, "name");
logProperty(person1, "age");
logProperty(person1, "eyes");
logProperty(person1, "height");


const objectName = {
member1Name: member1Value,
member2Name: member2Value,
member3Name: member3Value,
};
logProperty(person2, "name");
logProperty(person2, "age");
logProperty(person2, "eyes");
logProperty(person2, "height");

const myDiv = document.createElement("div");
const myVideo = document.querySelector("video");
Expand Down

0 comments on commit c81d0fd

Please sign in to comment.