Buttons and the Math Class

This web page allows you to see some of the operations that can be performed using the Math object from JavaScript (actually it's the Math class, but we'll say object, just to stick with the text's terminology). The form below allows you to perform certain mathematical operations that are commonly used in developing programs. It is also our first example of JavaScript that interacts with an HTML form.

Each paragraph of the form below allows you to enter values and click a button to see the result. The Math.random() method requires no input, so you just click that button without entering any data. The reset button will reset the form to it's original state.

The "round down" operation: Math.floor( ) =   

The "round up" operation: Math.ceil( ) =    

The square root operation: Math.sqrt( ) =    

The random real number operation: Math.random(  ) =    

Click this button to reset the form to its original status.