Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
finished mdn object walkthrough
  • Loading branch information
kmr18006 committed Feb 22, 2024
1 parent 7f2223f commit 5568249
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions week-06/index.html
@@ -0,0 +1,47 @@
<!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>
const person = {
name: {
first: "Bob",
last: "Smith",
},
age: 32,
bio() {
console.log(`${this.name.first} ${this.name.last} is ${this.age} years old.`);
},
introduceSelf() {
console.log(`Hi! I'm ${this.name.first}.`);
},
};

const person1 = {
name: "Chris",
introduceSelf() {
console.log(`Hi! I'm ${this.name}.`);
},
};

const person2 = {
name: "Deepti",
introduceSelf() {
console.log(`Hi! I'm ${this.name}.`);
},
};

const myDataName = "height";
const myDataValue = "1.75m";
person[myDataName] = myDataValue;
</script>
</body>

</html>

0 comments on commit 5568249

Please sign in to comment.