-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule2.js
50 lines (41 loc) · 858 Bytes
/
module2.js
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
function all(x) {
let j = '<tr>'
for (let i = 0; i <= x; i++) {
if (i < 1) {
j += `<td style="background-color:grey;color:white;"> x </td>`
} else {
j += `<td style="background-color:grey;color:white;"> ${i} </td>`
}
}
j += '</tr>'
return j
}
function final(a, y) {
let f = ''
for (let b = 1; b <= y; b++) {
if (a * b == a) {
f += `<td> ${a} </td>`
}
f += `
<td> ${a * b} </td>`
}
return f
}
function all2(x, y) {
let k = ''
for (let a = 1; a <= x; a++) {
k += `
<tr>
${final(a, y)}
</tr>
`
}
return k
}
function multiplication(xAxis, yAxis) {
return `
${all(xAxis)}
${all2(xAxis, yAxis)}
`
}
export default multiplication