-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrow.html
More file actions
41 lines (35 loc) · 689 Bytes
/
Copy patharrow.html
File metadata and controls
41 lines (35 loc) · 689 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
33
34
35
36
37
38
39
40
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Arrow functions</title>
<script>
window.onload = function() {
let p1 = document.getElementById("clickme1");
let p2 = document.getElementById("clickme2");
p1.onclick = function() {
console.log("(1) This is:", this);
};
p2.onclick = () => console.log("(2) This is:", this);
let o = {
clickMe1: function() {
console.log("(1) o, this is", this);
},
clickMe2: () => {
console.log("(2) o, this is", this);
}
};
o.clickMe1();
o.clickMe2();
};
</script>
</head>
<body>
<p id="clickme1">
This is paragraph 1. Click me!
</p>
<p id="clickme2">
This is paragraph 2. Click me!
</p>
</body>
</html>