Skip to Content

JavaScript Standard Properties and Functions

These standard JavaScript functions—part of ECMA-262 v5.1—are supported in Jitterbit JavaScripts.

Important

For enhanced performance, we recommend using JavaScript only when a Jitterbit Script equivalent is not available.

Note

  • The maximum number of loop iterations allowed in Harmony is 50,000.
  • The maximum number of loop iterations in Jitterbit Script Language is per each individual loop. To increase the allowed number of iterations per loop in a Jitterbit Script Language script, see jitterbit.scripting.while.max_iterations in Scripting Jitterbit Variables.
  • The maximum number of loop iterations in JavaScript is per script (aggregate of all loops within one script). To increase the maximum number of loop iterations in JavaScript, see Java Script Loop in JavaScript.

JavaScript Array Properties and Functions

Array Property Description
array.constructor Returns the function that creates the Array object's prototype
array.length Returns the length of an array
Array.prototype The object that allows adding properties and methods to an Array object
Array Function Description
array.concat() Joins two or more arrays, returning a copy of the joined arrays
array.every() Checks if every element in an array pass a test (function)
array.filter() Creates a new array with every element in an array that pass a test (function)
array.forEach() Calls a function for each element in an array
array.indexOf() Searches an array for an element and returns its position
Array.isArray() Checks if an object is an array
array.join() Joins all the elements of an array into a string
array.lastIndexOf() Searches an array for an element, starting at the end, and returns its position
array.map() Creates a new array with the result of calling a function for each element in an array
array.pop() Removes the last element of an array and returns that element
array.push() Adds new elements at the end of an array and returns the new length
array.reduce() Reduces the values of an array to a single value (from left-to-right)
array.reduceRight() Reduces the values of an array to a single value (from right-to-left)
array.reverse() Reverses the order of the elements in an array
array.shift() Removes the first element of an array, and returns that element
array.slice() Selects a portion of an array and returns the new array
array.some() Checks if any of the elements in an array pass a test (function)
array.sort() Sorts the elements of an array
array.splice() Adds or removes elements from an array
array.toLocaleString() Converts an array to a string and returns the result, using locale conventions
array.toString() Converts an array to a string and returns the result
array.unshift() Adds new elements to the beginning of an array and returns the new length
array.valueOf() Returns the primitive value of an array

JavaScript Date Properties and Functions

Warning

ECMA-262 v5.1 has issues with the handling of dates and daylight savings time. Be aware of these if using these functions.

Date Property Description
date.constructor Returns the function that creates the Array object's prototype
Date.prototype The object that allows adding properties and methods to a Date object
Date Function Description
date.getDate() Returns the day of the month (from 1-31)
date.getDay() Returns the day of the week (from 0-6)
date.getFullYear() Returns the year
date.getHours() Returns the hour (from 0-23)
date.getMilliseconds() Returns the milliseconds (from 0-999)
date.getMinutes() Returns the minutes (from 0-59)
date.getMonth() Returns the month (from 0-11)
date.getSeconds() Returns the seconds (from 0-59)
date.getTime() Returns the number of milliseconds since midnight January 1 1970, and a specified date
date.getTimezoneOffset() Returns the time difference between UTC time and local time, in minutes
date.getUTCDate() Returns the day of the month, according to universal time (from 1-31)
date.getUTCDay() Returns the day of the week, according to universal time (from 0-6)
date.getUTCFullYear() Returns the year, according to universal time
date.getUTCHours() Returns the hour, according to universal time (from 0-23)
date.getUTCMilliseconds() Returns the milliseconds, according to universal time (from 0-999)
date.getUTCMinutes() Returns the minutes, according to universal time (from 0-59)
date.getUTCMonth() Returns the month, according to universal time (from 0-11)
date.getUTCSeconds() Returns the seconds, according to universal time (from 0-59)
date.getFullYear() Returns the full year
Date.now() Returns the number of milliseconds since midnight January 1, 1970
Date.parse() Parses a date string and returns the number of milliseconds since midnight January 1, 1970
date.setDate() Sets the day of the month of a Date object
date.setFullYear() Sets the year of a Date object
date.setHours() Sets the hour of a Date object
date.setMilliseconds() Sets the milliseconds of a Date object
date.setMinutes() Set the minutes of a Date object
date.setMonth() Sets the month of a Date object
date.setSeconds() Sets the seconds of a Date object
date.setTime() Sets a date of a Date object to a specified number of milliseconds after/before January 1, 1970
date.setUTCDate() Sets the day of the month of a Date object, according to universal time
date.setUTCFullYear() Sets the year of a Date object, according to universal time
date.setUTCHours() Sets the hour of a Date object, according to universal time
date.setUTCMilliseconds() Sets the milliseconds of a Date object, according to universal time
date.setUTCMinutes() Set the minutes of a Date object, according to universal time
date.setUTCMonth() Sets the month of a Date object, according to universal time
date.setUTCSeconds() Set the seconds of a Date object, according to universal time
date.toDateString() Converts the date portion of a Date object into a readable string
date.toISOString() Returns a date as a string, using the ISO standard
date.toJSON() Returns a date as a string, formatted as a JSON date
date.toLocaleDateString() Returns the date portion of a Date object as a string, using locale conventions
date.toLocaleTimeString() Returns the time portion of a Date object as a string, using locale conventions
date.toLocaleString() Converts a Date object to a string, using locale conventions
date.toString() Converts a Date object to a string
date.toTimeString() Converts the time portion of a Date object to a string
date.toUTCString() Converts a Date object to a string, according to universal time
Date.UTC() Returns the number of milliseconds in a date since midnight January 1, 1970, according to UTC time
date.valueOf() Returns the primitive value of a Date object

JavaScript Math Properties and Functions

Math Property Description
Math.E Returns Euler's number (about 2.71828182845905)
Math.LN2 Returns the natural logarithm of 2 (about 0.693147180559945)
Math.LN10 Returns the natural logarithm of 10 (about 2.30258509299405)
Math.LOG2E Returns the base-2 logarithm of e (about 1.44269504088896)
Math.LOG10E Returns the base-10 logarithm of e (about 0.434294481903252)
Math.PI Returns π (about 3.14159265358979)
Math.SQRT1_2 Returns the square root of 1/2 (about 0.707106781186548)
Math.SQRT2 Returns the square root of 2 (about 1.4142135623731)
Math Function Description
Math.abs(x) Returns the absolute value of x
Math.ceil(x) Returns x rounded up to the nearest integer
Math.exp(x) Returns the value of ex
Math.floor(x) Returns x rounded down to the nearest integer
Math.max(x, y, z) Returns the number with the lowest value
Math.min(x, y, z) Returns the number with the highest value
Math.pow(x, y) Returns the value of x to the power of y
Math.random() Returns a random number between 0 and 1
Math.sqrt(x) Returns the square root of x
Math.acos(x) Returns the arccosine of x (where x is in radians)
Math.asin(x) Returns the arcsine of x (where x is in radians)
Math.atan(x) Returns the arctangent of x as a numeric value between -π/2 and π/2 radians
Math.atan2(y, x) Returns the arctangent of the quotient of its arguments
Math.cos(x) Returns the cosine of x (where x is in radians)
Math.log(x) Returns the natural logarithm (base e) of x
Math.round(x) Rounds x to the nearest integer
Math.sin(x) Returns the sine of x (where x is in radians)
Math.tan(x) Returns the tangent of x (where x is in radians)

JavaScript String Properties and Functions

String Property Description
string.constructor Returns the function that creates the String object's prototype
string.length Returns the length of a string
String.prototype The object that allows adding properties and methods to a String object
String Function Description
string.charAt() Returns the character at the specified index (position)
string.charCodeAt() Returns the Unicode of the character at the specified index
string.concat() Joins two or more strings, and returns a new joined strings
string.endsWith() Checks whether a string ends with specified string/characters
string.indexOf() Returns the position of the first found occurrence of a specified value in a string
string.lastIndexOf() Returns the position of the last found occurrence of a specified value in a string
string.localeCompare() Compares two strings in the current locale
string.match() Searches a string for a match against a regular expression, and returns the matches
string.replace() Searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced
string.search() Searches a string for a specified value, or regular expression, and returns the position of the match
string.slice() Extracts a part of a string and returns a new string
string.split() Splits a string into an array of substrings
string.startsWith() Checks whether a string begins with specified characters
string.substr() Extracts the characters from a string, beginning at a specified start position, and through the specified number of character
string.substring() Extracts the characters from a string, between two specified indices
string.toLocaleLowerCase() Converts a string to lowercase letters, according to the host's locale
string.toLocaleUpperCase() Converts a string to uppercase letters, according to the host's locale
string.toLowerCase() Converts a string to lowercase letters
string.toString() Returns the value of a String object
string.toUpperCase() Converts a string to uppercase letters
string.trim() Removes whitespace from both ends of a string
string.valueOf() Returns the primitive value of a String object