0% found this document useful (0 votes)
3 views2 pages

MMF117V JS Functions

The document is a reference sheet for JavaScript functions, detailing various Math, Number, and String methods. It includes descriptions of each function, such as abs, acos, and concat, along with their purposes and return values. This serves as a quick guide for developers to understand and utilize JavaScript's built-in functionalities.

Uploaded by

Mohlala Sydney
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

MMF117V JS Functions

The document is a reference sheet for JavaScript functions, detailing various Math, Number, and String methods. It includes descriptions of each function, such as abs, acos, and concat, along with their purposes and return values. This serves as a quick guide for developers to understand and utilize JavaScript's built-in functionalities.

Uploaded by

Mohlala Sydney
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Man-machine interface MMF117V JS functions sheet

Functions

JavaScript Math. Functions/Methods


abs(x) Returns the absolute value of x
acos(x) Returns the arccosine of x, in radians
acosh(x) Returns the hyperbolic arccosine of x
asin(x) Returns the arcsine of x, in radians
asinh(x) Returns the hyperbolic arcsine of x
atan(x) Returns the arctangent of x as a numeric value between -PI/2 and PI/2
radians
atan2(y, x) Returns the arctangent of the quotient of its arguments
atanh(x) Returns the hyperbolic arctangent of x
cbrt(x) Returns the cubic root of x
ceil(x) Returns x, rounded upwards to the nearest integer
cos(x) Returns the cosine of x (x is in radians)
cosh(x) Returns the hyperbolic cosine of x
exp(x) Returns the value of Ex
floor(x) Returns x, rounded downwards to the nearest integer
log(x) Returns the natural logarithm (base E) of x
max(x, y, z, ..., n) Returns the number with the highest value
min(x, y, z, ..., n) Returns the number with the lowest value
pow(x, y) Returns the value of x to the power of y
random() Returns a random number between 0 and 1
round(x) Rounds x to the nearest integer
sign(x) Returns if x is negative, null or positive (-1, 0, 1)
sin(x) Returns the sine of x (x is in radians)
sinh(x) Returns the hyperbolic sine of x
sqrt(x) Returns the square root of x
tan(x) Returns the tangent of an angle
tanh(x) Returns the hyperbolic tangent of a number
trunc(x) Returns the integer part of a number (x)
Math.E Returns Euler's number
Math.PI Returns PI
Math.SQRT2 Returns the square root of 2
Math.SQRT1_2 Returns the square root of 1/2
Math.LN2 Returns the natural logarithm of 2
Math.LN10 Returns the natural logarithm of 10
Math.LOG2E Returns base 2 logarithm of E
Math.LOG10E Returns base 10 logarithm of E
JavaScript Number. Functions/Methods
toString() Returns a number as a string
toExponential() Returns a number written in exponential notation
toFixed() Returns a number written with a number of decimals
toPrecision() Returns a number written with a specified length
Man-machine interface MMF117V JS functions sheet

valueOf() Returns a number as a number


JavaScript String. Functions/Methods
at() Returns an indexed character from a string
charAt() Returns the character at a specified index (position)
charCodeAt() Returns the Unicode of the character at a specified index
codePointAt() Returns the Unicode value at an index (position) in a string
concat() Returns two or more joined strings
constructor Returns the string's constructor function
endsWith() Returns if a string ends with a specified value
fromCharCode() Returns Unicode values as characters
includes() Returns if a string contains a specified value
indexOf() Returns the index (position) of the first occurrence of a value in a string
lastIndexOf() Returns the index (position) of the last occurrence of a value in a string
length Returns the length of a string
localeCompare() Compares two strings in the current locale
match() Searches a string for a value, or a regular expression, and returns the
matches
padEnd() Pads a string at the end
padStart() Pads a string from the start
prototype Allows you to add properties and methods to an object
repeat() Returns a new string with a number of copies of a string
replace() Searches a string for a pattern, and returns a string where the first match is
replaced
replaceAll() Searches a string for a pattern and returns a new string where all matches
are replaced
search() Searches a string for a value, or regular expression, and returns the index
(position) of the match
slice() Extracts a part of a string and returns a new string
split() Splits a string into an array of substrings
startsWith() Checks whether a string begins with specified characters
substr() Extracts a number of characters from a string, from a start index (position)
substring() Extracts characters from a string, between two specified indices (positions)
toLocaleLowerCase() Returns a string converted to lowercase letters, using the host's locale
toLocaleUpperCase() Returns a string converted to uppercase letters, using the host's locale
toLowerCase() Returns a string converted to lowercase letters
toString() Returns a string or a string object as a string
toUpperCase() Returns a string converted to uppercase letters
trim() Returns a string with removed whitespaces
trimEnd() Returns a string with removed whitespaces from the end
trimStart() Returns a string with removed whitespaces from the start
valueOf() Returns the primitive value of a string or a string object

You might also like