Skip to content

Commit

Permalink
Week-06 Done
Browse files Browse the repository at this point in the history
  • Loading branch information
hol23003 committed Feb 26, 2024
1 parent 8172847 commit a4ad806
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
63 changes: 63 additions & 0 deletions week-06/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
function createPerson(name) {
const obj = {};
obj.name = name;
obj.introduceSelf = function () {
console.log(`Hi! I'm ${this.name}.`);
};
return obj;
}

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

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

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

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

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

logProperty("name");

logProperty("age");


const objectName = {
member1Name: member1Value,
member2Name: member2Value,
member3Name: member3Value,
};

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

const myNotification = new Notification("Hello!");

16 changes: 16 additions & 0 deletions week-06/oojs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Object-oriented JavaScript example</title>
</head>

<body>
<p>This example requires you to enter commands in your browser's JavaScript console (see <a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools">What are browser developer tools</a> for more information).</p>

<script src="js/script.js"></script>

</body>

</html>

0 comments on commit a4ad806

Please sign in to comment.