Javascript has many pre-defined functions and functions which are used extensively are
Conversion and Comparison – Functions used for data conversion and comparison
escape(string) – Encodes a string from ASCII into an ISO Latin-1 (ISO 8859-1) character set for HTML processing. It is passed the string to be encoded, and returns the encoded string.
unescape – Converts an ISO8859-1 character set to ASCII.
eval()– Converts a string to integer or float value.
isNaN(value) – If the value passed is a not a number, the boolean value of true is returned, if it is a number, it returns false.
parseFloat() – Returns floating point numbers the same as the parseInt function, but looks for floating point qualified strings and returns their value as a float.
parseInt()– Converts a string to an integer returning the first integer encountered which is contained in the string. If no integer value are found such as in the string “abcd”, then a value of 0 is returned.
typeof operator – This operator returns the type of the object it operates on. Values returned are string values and may be one of “undefined”, “object”, “function”, “number”, “Boolean”, or “string”.
Methods that belong to all objects
toString() – Converts an object to a string. The syntax is shown below. Radix is the base value for the conversion, which may be 10 for decimal conversion. The value 1 is used for binary conversion, and 8 is used for octal conversion.
Dialog Boxes
alert(message) – Displays an alert box with a message defined by the string message. Example:
confirm(message) – When called, it will display the message and two boxes. One box is “OK” and the other is “Cancel”.
prompt(message) – Displays a box with the message passed to the function displayed. The user can then enter text in the prompt field, and choose OK or Cancel. If the user chooses Cancel, a NULL value is returned. If the user chooses OK, the string value entered in the field is returned.