@@ -1241,14 +1241,15 @@ <h5 style="font-size:160%;margin:7px;">Area of a regular polygon</h5>
12411241 return ;
12421242 }
12431243
1244- // Polygon validity check
1244+ // Polygon validity check
1245+
12451246 if ( number < 3 ) {
12461247 document . getElementById ( 'polygon-area' ) . innerText = 'It takes at least three sides to form a polygon.' ;
12471248 return ;
12481249 }
1250+
12491251 const ratio = 3.2 / number ;
12501252 const tangent = parseFloat ( tan ( ratio ) ) ;
1251-
12521253 const area = polygonArea ( length , number , tangent ) ;
12531254
12541255 document . getElementById ( 'polygon-area' ) . innerText =
@@ -1354,6 +1355,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
13541355
13551356 document . getElementById ( 'circle-radius-a' ) . addEventListener ( 'input' , function ( ) {
13561357 const radius = parseFloat ( this . value ) ;
1358+
13571359 if ( isNaN ( radius ) ) {
13581360 document . getElementById ( 'circle-area' ) . innerText = '' ;
13591361 return ;
@@ -1704,6 +1706,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
17041706
17051707 document . getElementById ( 'sphere-radius' ) . addEventListener ( 'input' , function ( ) {
17061708 const radius = parseFloat ( this . value ) ;
1709+
17071710 if ( isNaN ( radius ) ) {
17081711 document . getElementById ( 'sphere-volume' ) . innerText = '' ;
17091712 return ;
@@ -2195,10 +2198,6 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
21952198 `Volume: ${ volume . toFixed ( 5 ) } cubic units` ;
21962199}
21972200
2198- document . getElementById ( 'frustum-cone-volume' ) . innerText =
2199- `Volume: ${ volume . toFixed ( 5 ) } cubic units` ;
2200- }
2201-
22022201document . getElementById ( 'frustum-cone-base-radius' ) . addEventListener ( 'input' , updateFrustumConeVolume ) ;
22032202document . getElementById ( 'frustum-cone-top-radius' ) . addEventListener ( 'input' , updateFrustumConeVolume ) ;
22042203document . getElementById ( 'frustum-cone-height' ) . addEventListener ( 'input' , updateFrustumConeVolume ) ;
@@ -2436,7 +2435,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
24362435
24372436 document . getElementById ( 'pyramid-volume' ) . innerText =
24382437 `Volume: ${ volume . toFixed ( 5 ) } cubic units` ;
2439- }
2438+ }
24402439
24412440document . getElementById ( 'pyramid-side-number' ) . addEventListener ( 'input' , updatePyramidVolume ) ;
24422441document . getElementById ( 'pyramid-base-edge-length' ) . addEventListener ( 'input' , updatePyramidVolume ) ;
0 commit comments