Including an easy-to-use stop watch
So here you have a list of Turboid arithmetic and time-related functions:
Returns a random number which is greater than or equal to zero and at the same time smaller than or equal to max.
Returns an array of the digits of numVal.
Returns the number of digits in numVal.
round(value [, numOfDigits])
Rounds a number value like Math.round(), but allows delimiting the number of positions after the decimal point (numOfDigits, optional).
A very important function for extracting numbers in strings containing letters and other characters. Example: numIn("width:50px") returns 50 (as a number, not a string).
Makes an odd number even by reducing it to the next lower even integer number if necessary. Alternative notation: _(num).makeEven()
Returns whether number n is odd or not. Alternative notation: _(num).isOdd()
Returns whether number n is an integer number or not. Alternative notation: _(num).isInt()
Forces a number to have a certain amount of digits by putting additional zeros at the beginning. Returns a string. For example, forceDigits(568, 5) returns "00568".
Generates a stop watch. Provides two object functions, .start(), which starts the timer, and .stop(), which returns the measured time. Usage example:
var watch = new Clock(); watch.start(); alert("Do you want to see how long you have waited?"); alert("You have waited "+watch.stop()+" milliseconds");