File tree Expand file tree Collapse file tree 2 files changed +95
-0
lines changed
Find The Largest And Smallest Number On An Array Expand file tree Collapse file tree 2 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="utf-8 " />
5+ < title > page</ title >
6+ < link rel ="stylesheet " href ="https://use.fontawesome.com/releases/v5.5.0/css/all.css ">
7+ < style >
8+ body , html {
9+ padding : 0 ;
10+ margin : 20px ;
11+ background : # 333 ;
12+ color : # e53f3f ;
13+ font-family : Verdana;
14+ display : flex;
15+ height : 100vh ;
16+ justify-content : center;
17+ align-items : center
18+ }
19+ input {
20+ width : 265px ;
21+ display : inline-block;
22+ border : none;
23+ border-radius : 20px 0px 0px 20px ;
24+ padding : 5px ;
25+ padding-left : 10px ;
26+ outline : none;
27+ font-family : Verdana;
28+ }
29+ # add {
30+ width : 50px ;
31+ position : relative;
32+ display : inline-block;
33+ border : none;
34+ border-radius : 0px 20px 20px 0px ;
35+ padding : 4px ;
36+ margin-left : -5px ;
37+ top : -1.5px ;
38+ background : # e53f3f ;
39+ color : # fff ;
40+ font-size : 14px ;
41+ outline : none;
42+ }
43+ button {
44+ width : 160px ;
45+ padding : 5px ;
46+ background : # e53f3f ;
47+ color : # fff ;
48+ border : none;
49+ margin-top : 10px ;
50+ margin-left : 5px ;
51+ }
52+ h2 {
53+ font-size : 16px ;
54+ }
55+
56+ </ style >
57+ </ head >
58+ < body >
59+
60+ < div class ="container ">
61+ < h2 > Find the largest and smallest number on an array</ h2 >
62+ < input type ="number " id ="numbers " placeholder ="Enter as many numbers as you want. " />
63+ < button onclick ="add() " id ="add "> ADD</ button > < br />
64+ < button onclick ="small() "> Smallest number</ button >
65+ < button onclick ="bigger() "> Biggest number</ button >
66+ </ div >
67+
68+
69+ < script >
70+
71+
72+ let NumValues = [ ] ;
73+
74+ function add ( ) {
75+ let numbers = document . getElementById ( "numbers" ) . value ;
76+ NumValues . push ( numbers ) ;
77+ console . log ( NumValues )
78+ }
79+
80+ function small ( ) {
81+ let min = Math . min . apply ( Math , NumValues ) ;
82+ alert ( min )
83+ }
84+
85+ function bigger ( ) {
86+ let max = Math . max . apply ( Math , NumValues ) ;
87+ alert ( max )
88+ }
89+
90+
91+ </ script >
92+
93+
94+ </ body >
95+ </ html >
You can’t perform that action at this time.
0 commit comments