-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path06-functionWithArguments.html
More file actions
26 lines (23 loc) · 976 Bytes
/
06-functionWithArguments.html
File metadata and controls
26 lines (23 loc) · 976 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Demo</title>
</head>
<body>
<script type="text/javascript">
// Playing with functions - a mini program that can be re-used
// first we need to declare a 'function' and give it a name
// The `()` are what hold the parameters of the function.
function myFunction(myArgument, nextArgument) {
// This is called the 'Decloration'
document.write('Oh snap! I LOVE ' + myArgument + ' and ' + nextArgument + '</br>'); // Simple alert box with text
}
// Call your function and pass in the arguments
myFunction('Bacon', 'Cheese'); // calls the function automatically into action
myFunction('Star Wars', 'Darth Vader');
myFunction('Beer', 'Code');
</script>
</body>
</html>