-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.html
More file actions
112 lines (83 loc) · 3.73 KB
/
module.html
File metadata and controls
112 lines (83 loc) · 3.73 KB
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
<!DOCTYPE html>
<html>
<script src="app.js" type="module"></script>
<body>
Addition :
<input type="text" value="0" id="numer1" size="10"> +
<input type="text" value="0" id="numer2" size="10"> =
<span id="result" style="font-size: 32px; color: blue;">0</span>
<button onclick="sumNum()" style="font-size:18px;">Result</button>
<br> Substraction :
<input type="text" value="0" id="numer3" size="10"> -
<input type="text" value="0" id="numer4" size="10"> =
<span id="result2" style="font-size: 32px; color: yellow;">0</span>
<button onclick="Substraction()" style="font-size:18px;">Result</button>
<br> Multiply :
<input type="text" value="0" id="numer5" size="10"> *
<input type="text" value="0" id="numer6" size="10"> =
<span id="result3" style="font-size: 32px; color: black;">0</span>
<button onclick="Multiply()" style="font-size:18px;">Result</button>
<br> Divided :
<input type="text" value="0" id="numer7" size="10"> /
<input type="text" value="0" id="numer8" size="10"> =
<span id="result4" style="font-size: 32px; color: purple;">0</span>
<button onclick="Divided()" style="font-size:18px;">Result</button>
<script>
function sumNum() {
var numer1 = parseInt(document.getElementById("numer1").value);
var numer2 = parseInt(document.getElementById("numer2").value);
// console.log("Sum: " + numer1 + numer2);
document.getElementById("result").innerHTML = numer1 + numer2;
}
function Substraction() {
var numer3 = parseInt(document.getElementById("numer3").value);
var numer4 = parseInt(document.getElementById("numer4").value);
//console.log("Substraction: " + (numer3 - numer4));
document.getElementById("result2").innerHTML = numer3 - numer4;
}
function Multiply() {
var numer5 = parseInt(document.getElementById("numer5").value);
var numer6 = parseInt(document.getElementById("numer6").value);
// console.log("Substraction: " + numer4 + numer5);
document.getElementById("result3").innerHTML = numer5 * numer6;
}
function Divided() {
var numer7 = parseInt(document.getElementById("numer7").value);
var numer8 = parseInt(document.getElementById("numer8").value);
// console.log("Divided: " + numer7 + numer8);
document.getElementById("result4").innerHTML = numer7 / numer8;
}
</script>
<h2>JavaScript Module</h2>
<pre>
<p>math.js</p>
export {
sumAll as
default
};
export {
sumAll,
subtractAll,
divideAll,
multiplyAll
};
let sumAll = (a, b) => {
return a + b;
}
let subtractAll = (a, b) => {
return a - b;
}
let divideAll = (a, b) => {
return a / b;
}
let multiplyAll = (a, b) => {
return a * b;
}
let findModulus = (a, b) => {
return a % b;
<p>app.js</p>
import * as math from './math.js';
console.log(math.multiplyAll(9, 8));
</pre>
</body>
</html>