Next: Events
Up: Functions
Previous: Parameter Passing
JavaScripts has many inbuilt functions
- Usual Maths functions for trigonometry, sin(), cos() etc.
-
It also has many other useful but not so obvious functions:
- parseInt()
- : takes in a string as parameter and returns it in integer
format.,
-
parseFloat()
- : takes a string as parameter and returns a floating point
representation of it
-
eval()
- : String versions of mathematical expressions can be passed into the function
where they are evaluated and the result
returned as an integer.
- Ideal for bringing simple interactivity to a page.
- For
instance:
eval("32 * 75674.21");
Dave Marshall
9/28/2001