Other retrievable values are in the form of getSeconds(), getMinutes(), getHours(), getDay(), and getTime(), for seconds, minutes, hours, day of the week, and milliseconds since Jan. 1, 1970 respectively.
Using Operators. Operators that perform mathematical calculations are called arithmetic operators. Those that work on two variables are called binary operators. For example, the + operator can add two numbers or combine two elements. Operators that work with one variable are called unary operators. These include increment, decrement and negation operators. Assignment operators manipulate elements in an expression and assign values. For example, the equals sign assigns a value to a variable.
In the following function the arithmetic multiplier is used to find volume of a rectangular solid.
var Rounded = Math.round(Number);
Other Math methods include Math.abs for absolute value, Math.sin and other trigonometric functions which return a number in radians, Math.floor and Math.ceil for rounding down or up to the nearest integer, Math.exp raises the value of E to the value of the number, Math.log returns the natural logarithm of the number, Math.random returns a random number between 0 and 1, and Math.toString converts the number to a text string. All these Math methods act on a single variable. Several others act as comparatives of, or act on two numbers. Math.max(x,y) and Math.min(x,y) return the greator or lessor, resp[ectively, of two number variables. Math.pow(x,y) returns the value of the first number raised toth pwer of the second number.
Program Loops. Code that is repeated is called a loop. Loops can repeat a specified number of times, or until a condition is met. The For loop creates a group of commands that will execute a specific number of times, as controlled by a counter. The While loop runs as long as a condition is met, and does not employ a counter. The condition is expressed by Boolean operators.
Browser software contains built-in scripting, including objects. The World Wide Web Consortium has set standards for this hierarchical collection of objects, known as the Document Objects Model (DOM). This object collection is also referred to as the Browser Object Model. Not all browsers have the same built-in objects.
Form Validation is a common use of event handlers. If a user enters an incorrect value in an input the browser can display a dialog box with a custonizable message informing the user of the error and providing any necessary directions.