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
|
var x
var y = 12
var a_var = 1
let a_let = 2
const a_const = 3
const tmpl = `template` + `t${i + 6}` + `t${i + `nested${i}`}` + `t${function () {
return 5
}()}` + `t\${i}
${i + 2}`
function foo(a, b) {
x = 15
x += 4
}
var foo = function (a, b = 0) {}
function spread() {
iterableObj = [1, 2]
obj = {
"a": 42
}
foo(...iterableObj)
let arr = [...iterableObj, '4', 'five', 6]
foo(-1, ...args, 2, ...[3])
console.log(Math.max(...[1, 2, 3, 4]))
}
const func1 = x => x * 2
const func2 = x => {
return x * 7
}
const func3 = (x, y) => x + y
const func4 = (x, y) => {
return x + y
}
const s1 = `test`
const s2 = `${42 * 1}`
const s3 = `test ${s2}`
const s4 = `${s2}${s3}test`
while (true) {
for (var a = 1; a < 5; ++a) {
switch (a) {
case 1:
++a
break
case 2:
a += 2
foo()
break
default:
break
case 3:
continue
}
}
for (var x in a) {
print(a[x])
}
for (let x in a) {
print(a[x])
}
for (const x in a) {
print(a[x])
}
do {
a = x
x *= a
} while (a < x)
try {
Math.sqrt(a)
} catch (e) {
Math.sqrt(a)
} finally {
Math.sqrt(a)
}
try {
Math.sqrt(a)
} finally {
Math.sqrt(a)
}
try {
Math.sqrt(a)
} catch (e) {
Math.sqrt(a)
}
}
|