-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path08 - Functions.html
63 lines (49 loc) · 1.28 KB
/
08 - Functions.html
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Getting Started with JavaScript</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css">
<style>
body {
padding: 30px;
}
</style>
</head>
<body>
<div class="jumbotron text-center">
<button type="button" class="btn btn-danger" onclick="saySomething('this is the first button')">
My Button
</button>
<button type="button" class="btn btn-danger" onclick="saySomething('this is the second button')">
My 2nd Button
</button>
</div>
<!-- 🔥🔥🔥🔥 start javascript 🔥🔥🔥🔥 -->
<script>
function saySomething(message = 'goodbye', whisper = false) {
if (whisper) {
console.log(`%c${message}`, 'font-size:5px');
} else {
console.log(message);
}
}
saySomething('hello', true);
saySomething('my name is chris', true);
saySomething();
// function squared(a) {
// return a * a;
// }
// const newSquared = squared(3);
// console.log(newSquared);
const squared = (a) => {
return a * a;
}
const otherSquared = squared;
punch();
function punch() {
console.log('punch here!');
}
</script>
</body>
</html>