-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
51 lines (37 loc) · 1.22 KB
/
test.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
<!DOCTYPE html>
<html>
<body>
<h1>My First Web Page</h1>
<script>
function jijou(x, y, z) {
let outList = [x, y];
function generate_values(a, b, z) {
if (z < 2) {
throw new Error("z must be greater than or equal to 2.");
}
if (b <= a) {
throw new Error("b must be greater than a.");
}
const step = (b - a) / (z - 1); // Uniform step size
const values = [];
let current_value = a;
for (let i = 0; i < z; i++) {
values.push(current_value);
current_value += step;
}
return values;
}
let i = 1;
while (outList.reduce((a, b) => a + b, 0) < z) {
i++;
console.log(outList);
outList = generate_values(x, y, i);
}
return outList;
}
const jj = jijou(5, 10, 480)
console.log(jj);
console.log(jj.reduce((partialSum, a) => partialSum + a, 0));
</script>
</body>
</html>