-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
57 lines (49 loc) · 1.13 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>replit</title>
</head>
<body>
Hello world
<button id="my-btn">Click me</button>
<script src="./index.js">
// {
// var a = 10
// let b = 100
// const c = 1000
// }
// console.log(a)
// console.log(b) // Reference Error since variable declare with let is block scoped
// console.log(c) // Reference Error since variable declare with const is block scoped
var length = 10
function fn() {
console.log(this.length)
}
fn()
var obj2 = {
length: 5,
method: function (fn) {
fn()
// console.log(arguments[0]())
arguments[0]()
},
}
// obj2.method(fn, 1)
;(function () {
console.log(1)
setTimeout(function () {
console.log(2)
}, 1000)
setTimeout(
(function () {
console.log(3)
})(),
3000
)
console.log(4)
})()
</script>
</body>
</html>