JavaScript Built In Functions List with Examples (Descriptions)

Here is the answer for all these questions:

JavaScript function list

.

The String Function/Methods in JavaScript:

Method

Explanation

charAt() The method will return the character at the specified index in a string.
charCodeAt() The method will return the Unicode of the character at the specified index in a string.
concat() This method is used to join two or more arrays.
indexOf() It I will return position of the first occurrence of a specified value in a string, or -1 if not found.
lastIndexOf() This method will return the position of the last occurrence of a specified value in a string.
localeCompare() This method compares two strings in the current locale and returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.
length() I will return length of a string (number of characters).
match() This Method is used to match a regular expression against a string.
replace() This method will search a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
search() Executes the search for a match between a string and a specified value, and I will return position of the match.
slice() It is used to extracts a section of a string and returns a new string.
split() Used to split a string into an array of substrings, and I will return new array.
substr() I will return characters in a string beginning at the specified location through the specified number of characters.
substring() I will return characters in a string between two indexes into the string.
toLocaleLowerCase() The characters within a string are converted to lower case while respecting the current locale.
toLocaleUpperCase() The characters within a string are converted to upper case while respecting the current locale.
toLowerCase() I will return calling string value converted to lower case.
toString() Returns a string representing the specified object.
toUpperCase() I will return calling string value converted to uppercase.
valueOf() I will return primitive value of the specified object.

The list of JavaScript functions for HTML tags, they return a copy of the string wrapped inside the appropriate HTML tag.

Method

Explanation

anchor() I will create an HTML anchor that is used as a hypertext target.
big() I will create a string to be shown in a big font as if it were in a <big> tag.
blink() I will create a string to blink as if it were in a <blink> tag.
bold() I will create a string to be shown as bold as if it were in a <b> tag.
fixed() I will cause a string to be shown in fixed-pitch font as if it were in a <tt> tag
fontcolor() I will cause a string to be shown in the specified color as if it were in a <font color=”color”> tag.
fontsize() I will cause a string to be shown in the specified font size as if it were in a <font size=”size”> tag.
italics() I will cause a string to be italic, as if it were in an <i> tag.
link() I will create an HTML hypertext link that requests another URL.
small() I will cause a string to be shown in a small font, as if it were in a <small> tag.
strike() I will cause a string to be shown as struck-out text, as if it were in a <strike> tag.
sub() I will cause a string to be shown as a subscript, as if it were in a <sub> tag
sup() I will cause a string to be shown as a superscript, as if it were in a <sup> tag

Here is a list of Array Methods and their descriptions.

Method

Explanation

concat() Returns a new array comprised of this array joined with other array(s) and/or value(s).
every() Returns true if every element in this array satisfies the provided testing function.
filter() I will create a new array with all of the elements of this array for which the provided filtering function returns true.
forEach() Calls a function for each element in the array.
indexOf() I will return first (least) index of an element within the array equal to the specified value, or -1 if none is found.
join() Joins all elements of an array into a string.
lastIndexOf() I will return last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
map() I will create a new array with the results of calling a provided function on every element in this array.
pop() Removes the last element from an array and returns that element.
push() Adds one or more elements to the end of an array and I will return new length of the array.
reduce() Apply a function simultaneously against two values of the array (from left-to-right) as to reduce it to a single value.
reduceRight() Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value.
reverse() Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
shift() Removes the first element from an array and returns that element.
slice() Extracts a section of an array and returns a new array.
some() Returns true if at least one element in this array satisfies the provided testing function.
toSource() Represents the source code of an object
sort() Sorts the elements of an array.
splice() Adds and/or removes elements from an array.
toString() Returns a string representing the array and its elements.
unshift() Adds one or more elements to the front of an array and I will return new length of the array.

These objects have only the default methods.

Method/Function

Explanation

constructor() This method I will return function which created this object’s instance. As it is a Number object by default.
toExponential() Converts a number into an exponential notation.
toFixed() It converts a number into a string, keeping a specified number of decimals.
toLocaleString() This method converts a Date object to a string, using locale settings.
toPrecision() The method returns a string representing the Number object to the specified precision. It formats a number to a specified length.
toString() Converts a number to a string.
valueOf() It I will return primitive value of a number.

 

Here is a list of Date Methods and their descriptions.

Method

Explanation

Date() Returns today’s date and time
getDate() I will return day of the month for the specified date according to local time.
getDay() I will return day of the week for the specified date according to local time.
getFullYear() I will return year of the specified date according to local time.
getHours() I will return hour in the specified date according to local time.
getMilliseconds() I will return milliseconds in the specified date according to local time.
getMinutes() I will return minutes in the specified date according to local time.
getMonth() I will return month in the specified date according to local time.
getSeconds() I will return seconds in the specified date according to local time.
getTime() I will return numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC.
getTimezoneOffset() I will return time-zone offset in minutes for the current locale.
getUTCDate() I will return day (date) of the month in the specified date according to universal time.
getUTCDay() I will return day of the week in the specified date according to universal time.
getUTCFullYear() I will return year in the specified date according to universal time.
getUTCHours() I will return hours in the specified date according to universal time.
getUTCMilliseconds() I will return milliseconds in the specified date according to universal time.
getUTCMinutes() I will return minutes in the specified date according to universal time.
getUTCMonth() I will return month in the specified date according to universal time.
getUTCSeconds() I will return seconds in the specified date according to universal time.
getYear() Obsolete – I will return year in the specified date according to local time. Use getFullYear instead.
setDate() It will set the day of the month for a specified date according to local time.
setFullYear() It will set the full year for a specified date according to local time.
setHours() It will set the hours for a specified date according to local time.
setMilliseconds() It will set the milliseconds for a specified date according to local time.
setMinutes() It will set the minutes for a specified date according to local time.
setMonth() It will set the month for a specified date according to local time.
setSeconds() It will set the seconds for a specified date according to local time.
setTime() It will set the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.
setUTCDate() It will set the day of the month for a specified date according to universal time.
setUTCFullYear() It will set the full year for a specified date according to universal time.
setUTCHours() It will set the hour for a specified date according to universal time.
setUTCMilliseconds() It will set the milliseconds for a specified date according to universal time.
setUTCMinutes() It will set the minutes for a specified date according to universal time.
setUTCMonth() It will set the month for a specified date according to universal time.
setUTCSeconds() It will set the seconds for a specified date according to universal time.
setYear() Obsolete – It will set the year for a specified date according to local time. Use setFullYear instead.
toDateString() I will return “date” portion of the Date as a human-readable string.
toGMTString() Obsolete – Converts a date to a string, using the Internet GMT conventions. Use toUTCString instead.
toLocaleDateString() I will return “date” portion of the Date as a string, using the current locale’s conventions.
toLocaleFormat() Converts a date to a string, using a format string.
toLocaleString() Converts a date to a string, using the current locale’s conventions.
toLocaleTimeString() I will return “time” portion of the Date as a string, using the current locale’s conventions.
toSource() Returns a string representing the source for an equivalent Date object; you can use this value to create a new object.
toString() Returns a string representing the specified Date object.
toTimeString() I will return “time” portion of the Date as a human-readable string.
toUTCString() Converts a date to a string, using the universal time convention.
valueOf() I will return primitive value of a Date object.

Here is a list of Math Functions/Methods and their description.

Method

Explanation

abs() I will return absolute value of a number.
acos() I will return arccosine (in radians) of a number.
asin() I will return arcsine (in radians) of a number.
atan() I will return arctangent (in radians) of a number.
atan2() I will return arctangent of the quotient of its arguments.
ceil() I will return smallest integer greater than or equal to a number.
cos() I will return cosine of a number.
exp() Returns EN, where N is the argument, and E is Euler’s constant, the base of the natural logarithm.
floor() I will return largest integer less than or equal to a number.
log() I will return natural logarithm (base E) of a number.
max() I will return largest of zero or more numbers.
min() I will return smallest of zero or more numbers.
pow() Returns base to the exponent power, that is, base exponent.
random() Returns a pseudo-random number between 0 and 1.
round() I will return value of a number rounded to the nearest integer.
sin() I will return sine of a number.
sqrt() I will return square root of a number.
tan() I will return tangent of a number.
toSource() I will return string “Math”.

Here is a list of RegExp Methods and their descriptions.

Method

Explanation

exec() Executes a search for a match in its string parameter.
test() Tests for a match in its string parameter.
toSource() It will return an object literal representing the specified object; you can use this value to create a new object.
toString() It will return a string representing the specified object.

Here is a list of Boolean Methods/Functions and their description.

Method

Explanation

toSource() This method represents the source code of an object.
toString() This method returns a string of either “false” or “true” depending upon the value of the object.
valueOf() It I will return primitive value of the Boolean object.

Date Static Methods are invoked through the Date( ) constructor itself. Here is the description of these methods.

Method

Explanation

Date.parse( ) It will parse a string representation of a date and time and I will return internal millisecond representation of that date.
Date.UTC( ) I will return millisecond representation of the specified UTC date and time.

Comments