forked from bethrobson/Head-First-JavaScript-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharguments.html
More file actions
32 lines (26 loc) · 534 Bytes
/
arguments.html
File metadata and controls
32 lines (26 loc) · 534 Bytes
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title> The arguments object </title>
<script>
function printArgs() {
for (var i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
}
printArgs("one", 2, 1+2, "four");
function emote(kind) {
if (kind === "silence") {
console.log("Player sits in silence");
} else if (kind === "says") {
console.log("Player says: '" + arguments[1] + "'");
}
}
emote("silence");
emote("says", "Stand back!");
</script>
</head>
<body>
</body>
</html>