forked from bethrobson/Head-First-JavaScript-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathduck.html
More file actions
21 lines (21 loc) · 356 Bytes
/
duck.html
File metadata and controls
21 lines (21 loc) · 356 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ducks</title>
<script>
function Duck(sound) {
this.sound = sound;
this.quack = function() {
console.log(this.sound);
};
}
var toy = new Duck("quack quack");
toy.quack();
console.log(typeof toy);
console.log(toy instanceof Duck);
</script>
</head>
<body>
</body>
</html>