-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
150 lines (135 loc) · 4.32 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTMLang</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<ul>
<for- (="salary of [1e5, 2e5, 3e5, 4e5]" )>
<if- (="{salary} < 2e5" )>
<li>ngmi with only ${salary} 😭</li>
</if->
<else-if- (="{salary} < 3e5" )>
<li>Scraping by with ${salary} 🫥</li>
</else-if->
<else-if- (="{salary} < 4e5" )>
<li>${salary} is ok, I guess 😏</li>
</else-if->
<else->
<li>Retire already, moneybags 🤑</li>
</else->
</for->
</ul>
<const- i="2" j="{i} + 1"></const->
<let- k="{j} + 1" l="{i} + {j}"></let->
<console- log(="i: {i}, j: {j}, k: {k}, l: {l}" )></console->
<const- bananas="'bananas'"></const->
<if- (="{i} + {j} === 5" )>
<console- log(="My favorite fruit is: {bananas}" )></console->
</if->
<if- (="1 + 1 === 3" )>
<console- log(="No it doesn't" )></console->
</if->
<else-if- (="1 + 1 === 4" )>
<console- log(="Still not right" )></console->
</else-if->
<else->
<console- log(="1 + 1 is 2 dummy" )></console->
</else->
<console- log(="k is {k}" )></console->
<statement- (="k = 5" )></statement->
<console- log(="k is now {k}" )></console->
<scope->
<let- k="6"></let->
<console- log(="k in this scope is {k}" )></console->
<statement- (="k = 7" )></statement->
<console- log(="k in this scope is now {k}" )></console->
</scope->
<console- log(="k in previous scope is back to {k}" )></console->
<const- fruits="['apples', 'oranges', {bananas}]"></const->
<ul>
<for- (="fruit of {fruits}" )>
<li>Fruit: {fruit}</li>
<console- log(="Logging fruit: {fruit}" )></console->
</for->
</ul>
<const- name="'Andy'"></const->
<console- log(="Hi, my name is {name}" )></console->
<scope->
<const- name="'Joe'"></const->
<const- age="42"></const->
<console- log(="Hi, my name is now {name}" )></console->
<console- log(="I am {age} years old" )></console->
<scope->
<console- log(="I am still {age} years old" )></console->
</scope->
</scope->
<console- log(="Hi, my name is {name} again" )></console->
<function- func-name(="a, b, c" )>
<const- sum="{a} + {b} + {c}"></const->
<pre>
a + b + c
{a} + {b} + {c}
{sum}
</pre>
</function->
<call- func-name(="1, 2, 3" )></call->
<call- func-name(="10, 20, 30" )></call->
<call- func-name(="'👁️', '💗', '🦋'" )></call->
<function- fizz-buzz(="num" )>
<if- (="{num} % 15 === 0" )>
<console- log(="{num}: FizzBuzz" )></console->
</if->
<else-if- (="{num} % 3 === 0" )>
<console- log(="{num}: Fizz" )></console->
</else-if->
<else-if- (="{num} % 5 === 0" )>
<console- log(="{num}: Buzz" )></console->
</else-if->
</function->
<for- (="i of [3, 5, 6, 9, 10, 12, 15, 18]" )>
<call- fizz-buzz(="{i}" )></call->
</for->
<function- add-two(="num" )>
<return->{num} + 2</return->
</function->
<const- n="5"></const->
<const- value="add-two({n})"></const->
<console- log(="{n} + 2 = {value}" )></console->
<function- is-prime(="num" )>
<switch- (="{num}" )>
<case- (="0" )></case->
<case- (="1" )>
<console- log(="{num}: not prime" )></console->
<break-></break->
</case->
<case- (="2" )>
<console- log(="{num}: prime!" )></console->
<break-></break->
</case->
<default->
<console- log(="{num}: 🤷♂️" )></console->
</default->
</switch->
</function->
<call- is-prime(="0" )></call->
<call- is-prime(="1" )></call->
<call- is-prime(="2" )></call->
<call- is-prime(="3" )></call->
<try->
<console- log(="Throw?" )></console->
<throw- (="'up 🤮'" )></throw->
<console- log(="Good choice" )></console->
</try->
<catch- (="e" )>
<console- log(="I threw {e}." )></console->
</catch->
<finally->
<console- log(="Finally!" )></console->
</finally->
</body>
</html>