methods
Summary
The following table lists JavaScript methods.
Syntax
Methods
Method | Description | JavaScript object |
---|---|---|
anchor | Places an HTML anchor that has a NAME attribute around text. | String |
apply | Applies a method of an object, substituting another object for the current object. | Function |
big | Places HTML <BIG> tags around text. | String |
bind | Creates a function that is associated with a specified object, and that can have specific initial parameters. | Function |
blink | Places HTML <BLINK> tags around text. | String |
bold | Places HTML <B> tags around text. | String |
call | Calls a method of an object, substituting another object for the current object. | Function |
charAt | Returns the character at the specified index. | String |
charCodeAt | Returns the Unicode encoding of the specified character. | String |
compile | Compiles a regular expression into an internal format. | Regular Expression |
concat | Returns a new array consisting of a combination of two arrays. | Array |
concat | Returns a String object containing the concatenation of two supplied strings. | String |
every | Checks whether a defined callback function returns true for all elements in an array. | Array |
exec | Executes a search for a match in a specified string. | Regular Expression |
filter | Calls a defined callback function on each element of an array, and returns an array of values for which the callback function returns true. | Array |
fixed | Places HTML <TT> tags around text. | String |
fontcolor | Places HTML <FONT> tags with a COLOR attribute around text. | String |
fontsize | Places HTML <FONT> tags with a SIZE attribute around text. | String |
forEach | Calls a defined callback function for each element in an array. | Array |
getDate | Returns the day-of-the-month value using local time. | Date |
getDay | Returns the day-of-the-week value using local time. | Date |
getFullYear | Returns the year value using local time. | Date |
getHours | Returns the hours value using local time. | Date |
getMilliseconds | Returns the milliseconds value using local time. | Date |
getMinutes | Returns the minutes value using local time. | Date |
getMonth | Returns the month value using local time. | Date |
getSeconds | Returns seconds value using local time. | Date |
getTime | Returns the time value in a Date Object as the number of milliseconds since midnight January 1, 1970. | Date |
getTimezoneOffset | Returns the difference in minutes between the time on the host computer and Universal Coordinated Time (UTC). | Date |
getUTCDate | Returns the day-of-the-month value using UTC. | Date |
getUTCDay | Returns the day-of-the-week value using UTC. | Date |
getUTCFullYear | Returns the year value using UTC. | Date |
getUTCHours | Returns the hours value using UTC. | Date |
getUTCMilliseconds | Returns the milliseconds value using UTC. | Date |
getUTCMinutes | Returns the minutes value using UTC. | Date |
getUTCMonth | Returns the month value using UTC. | Date |
getUTCSeconds | Returns the seconds value using UTC. | Date |
getYear | Returns the year value . | Date |
hasOwnProperty | Returns a Boolean value that indicates whether an object has a property with the specified name. | Multiple |
indexOf | Returns the index of the first occurrence of a value in an array. | Array |
indexOf | Returns the character position where the first occurrence of a substring occurs within a String object. | String |
isPrototypeOf | Returns a Boolean value that indicates whether an object exists in another object’s prototype chain. | Multiple |
italics | Places HTML <I> tags around text. | String |
join | Returns a String object consisting of all the elements of an array concatenated together. | Array |
lastIndexOf | Returns the index of the last occurrence of a specified value in an array. | Array |
lastIndexOf | Returns the last occurrence of a substring within a String object. | String |
link | Places an HTML anchor that has an HREF attribute around text. | String |
localeCompare | Returns a value indicating whether two strings are equivalent in the current locale. | String |
map | Calls a defined callback function on each element of an array, and returns an array that contains the results. | Array |
match | Returns, as an array, the results of a search on a string using a supplied Regular Expression object. | String |
pop | Removes the last element from an array and returns it. | Array |
propertyIsEnumerable | Returns a Boolean value that indicates whether a specified property is part of an object and whether it is enumerable. | Multiple |
push | Appends new elements to an array, and returns the new length of the array. | Array |
reduce | Accumulates a single result by calling a defined callback function for all elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. | Array |
reduceRight | Accumulates a single result by calling a defined callback function for all elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. | Array |
replace | Returns a copy of a string with text replaced using a regular expression. | String |
reverse | Returns an Array object with the elements reversed. | Array |
search | Returns the position of the first substring match in a regular expression search. | String |
setDate | Sets the numeric day of the month using local time. | Date |
setFullYear | Sets the year value using local time. | Date |
setHours | Sets the hours value using local time. | Date |
setMilliseconds | Sets the milliseconds value using local time. | Date |
setMinutes | Sets the minutes value using local time. | Date |
setMonth | Sets the month value using local time. | Date |
setSeconds | Sets the seconds value using local time. | Date |
setTime | Sets the date and time value in the Date object. | Date |
setUTCDate | Sets the numeric day of the month using UTC. | Date |
setUTCFullYear | Sets the year value using UTC. | Date |
setUTCHours | Sets the hours value using UTC. | Date |
setUTCMilliseconds | Sets the milliseconds value using UTC. | Date |
setUTCMinutes | Sets the minutes value using UTC. | Date |
setUTCMonth | Sets the month value using UTC. | Date |
setUTCSeconds | Sets the seconds value using UTC. | Date |
setYear | Sets the year value using local time. | Date |
shift | Removes the first element from an array and returns it. | Array |
slice | Returns a section of an array. | Array |
slice | Returns a section of a string. | String |
small | Places HTML <SMALL> tags around text. | String |
some | Checks whether a defined callback function returns true for any element of an array. | Array |
sort | Returns an Array object with the elements sorted. | Array |
splice | Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. | Array |
split | Returns the array of strings that results when a string is separated into substrings. | String |
strike | Places HTML <STRIKE> tags around text. | String |
sub | Places HTML <SUB> tags around text. | String |
substr | Returns a substring beginning at a specified location and having a specified length. | String |
substring | Returns the substring at a specified location within a String object. | String |
sup | Places HTML <SUP> tags around text. | String |
test | Returns a Boolean value that indicates whether or not a pattern exists in a searched string. | Regular Expression |
toDateString | Returns a date as a string value. | Date |
toExponential | Returns a string containing a number represented in exponential notation. | Number |
toFixed | Returns a string representing a number in fixed-point notation. | Number |
toGMTString | Returns a date converted to a string using Greenwich Mean Time (GMT). | Date |
toISOString | Returns a date as a string value in ISO format. | Date |
toJSON | Used to transform data of an object type before the JSON serialization. | Date |
toLocaleDateString | Returns a date as a string value appropriate to the host environment’s current locale. | Date |
toLocaleLowerCase | Returns a string where all alphabetic characters have been converted to lowercase, taking into account the host environment’s current locale. | String |
toLocaleString | Returns an object converted to a string using the current locale. | Multiple |
toLocaleTimeString | Returns a time as a string value appropriate to the host environment’s current locale. | Date |
toLocaleUpperCase | Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment’s current locale. | String |
toLowerCase | Returns a string where all alphabetic characters have been converted to lowercase. | String |
toPrecision | Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. | Number |
toString | Returns a string representation of an object. | Multiple |
toTimeString | Returns a time as a string value. | Date |
toUpperCase | Returns a string where all alphabetic characters have been converted to uppercase. | String |
toUTCString | Returns a date converted to a string using UTC. | Date |
trim | Returns a string with leading and trailing white space and line terminator characters removed. | String |
unshift | Inserts new elements at the start of an array. | Array |
valueOf | Returns the primitive value of the specified object. | Multiple |
See also
Other articles
- JavaScript Objects
- JavaScript Functions
- JavaScript Properties
- JavaScript Constants
- JavaScript Reference
Attributions
Microsoft Developer Network: Article