This section contains some methods that will be added to the standard Javascript objects.
Methods
-
Makes a shallow copy of the array.
Returns:
Type Description array A shallow copy of the array. -
Checks whether the array contains a given element.
Name Type Description element
any The element to search for.
Returns:
Type Description boolean True if the array contains a given element. -
Checks whether the two arrays are the same.
Name Type Description array
array The array to compare to.
Returns:
Type Description boolean True if the two arrays are the same. -
Removes a given element from the array (in place).
Name Type Description element
any The element to remove.
Returns:
Type Description array The array after remove. -
Generates a random integer in the range (0, max-1).
Name Type Description max
number The upper boundary (excluded).
Returns:
Type Description number A random integer. -
Returns a number whose value is limited to the given range.
Name Type Description min
number The lower boundary.
max
number The upper boundary.
Returns:
Type Description number A number in the range (min, max). -
Returns a modulo value which is always positive.
Name Type Description n
number The divisor.
Returns:
Type Description number A modulo value. -
Makes a number string with leading zeros.
Name Type Description length
number The length of the output string.
Returns:
Type Description string A string with leading zeros. -
Checks whether the string contains a given string.
Name Type Description string
string The string to search for.
Returns:
Type Description boolean True if the string contains a given string. -
Replaces %1, %2 and so on in the string to the arguments.
Name Type Description ...args
any The objects to format.
Returns:
Type Description string A formatted string. -
Makes a number string with leading zeros.
Name Type Description length
number The length of the output string.
Returns:
Type Description string A string with leading zeros.