File tree Expand file tree Collapse file tree 2 files changed +43
-21
lines changed Expand file tree Collapse file tree 2 files changed +43
-21
lines changed Original file line number Diff line number Diff line change 9
9
</ head >
10
10
11
11
< body >
12
- < script src ="script.js "> </ script >
13
- </ body >
14
-
15
- </ html >
16
-
17
-
18
-
19
- <!-- <form onsubmit="summarize()">
12
+ < form onsubmit ="summarize() ">
20
13
< label for ="a "> Input #1:</ label > < input type ="text " name ='a ' id ='a '/>
21
14
< br >
22
15
< label for ="b "> Input #2:</ label > < input type ="text " name ='b ' id ='b '/>
23
16
24
17
< button type ="submit "> Submit</ button >
25
18
</ form >
26
19
27
- <div id="summary"> </div> -->
20
+ < div id ="summary "> </ div >
21
+ < script src ="script.js "> </ script >
22
+ </ body >
23
+
24
+ </ html >
25
+
26
+
27
+
Original file line number Diff line number Diff line change 8
8
ES6 Syntax (Arrow function): const add = () => {}
9
9
*/
10
10
11
- function add ( ) {
12
- //Add function here
13
- }
11
+ // // function add(a,b){
12
+ // // //Add function here
13
+ // // return a + b;
14
+ // // }
15
+ // console.log(add(2,2))
14
16
15
- function sub ( ) {
16
- //Subtract function here
17
- }
17
+ // function sub(a, b){
18
+ // //Subtract function here
19
+ // return a - b;
20
+ // }
21
+ // console.log(sub(2,2));
18
22
19
- function div ( ) {
20
- //Divide function here
21
- }
23
+ // function div(a, b){
24
+ // //Divide function here
25
+ // return a / b;
26
+ // }
27
+ // console.log(div(2,2));
22
28
23
- function mul ( ) {
24
- //Multiply function here
25
- }
29
+ // function mul(a, b){
30
+ // //Multiply function here
31
+ // return a * b;
32
+ // }
33
+ // console.log(mul(2,2));
26
34
35
+
36
+ //ES6 Arrow functions
37
+
38
+ const add = ( a , b ) => a + b ;
39
+ console . log ( add ( 2 , 2 ) ) ;
40
+
41
+ const sub = ( a , b ) => a - b ;
42
+ console . log ( sub ( 2 , 2 ) ) ;
43
+
44
+ const div = ( a , b ) => a / b ;
45
+ console . log ( div ( 2 , 2 ) ) ;
46
+
47
+ const mul = ( a , b ) => a * b ;
48
+ console . log ( mul ( 2 , 2 ) )
27
49
console . log ( 'hello from the SUM exercise' )
28
50
/*
29
51
TODO: create a function that console logs the result of any of the above operations.
You can’t perform that action at this time.
0 commit comments