-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoojs.html
More file actions
45 lines (43 loc) · 1 KB
/
oojs.html
File metadata and controls
45 lines (43 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<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>
</body>
<script>
const person = {
name: ["Bob", "Dylan"],
age: 32,
gender: "male",
interests: ["music", "skiing"],
bio: function () {
alert(
this.name[0] +
" " +
this.name[1] +
" is " +
this.age +
" years old. He likes " +
this.interests[0] +
" and " +
this.interests[1] +
"."
);
},
greeting: function () {
alert("Hi! I'm " + this.name[0] + ".");
},
};
</script>
</html>