-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (45 loc) · 930 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<script type="importmap">
{
"imports": {
"metho": "../metho/metho.js"
}
}
</script>
<script type="module">
import * as mf from "./metho-function.js"
Object.assign(window, mf)
function fibonacci(num) {
if (num <= 1) return 1
const res = fibonacci(num - 1) + fibonacci(num - 2)
return res
}
function jon(x) {
return x ** x
}
let i, j
console.time("normal")
for (i = 0; i < 10000; i++) {
j = fibonacci(16)
}
console.log(j)
console.timeEnd("normal")
fibonacci = fibonacci[memoised]
console.time("memo")
for (i = 0; i < 10000; i++) {
j = fibonacci(16)
}
console.log(j)
console.timeEnd("memo")
// console.log(jon[memoised](3))
// console.log(jon[memoized](4))
// console.log(jon[memoised](3))
</script>
</body>
</html>