Provide a descriptive of methods in JavaScript object.
|
Method
|
Description
|
|
charAt()
|
returns the character at the specified index
|
|
concat()
|
joins two or more strings, and returns a copy of the joined strings
|
|
indexOf()
|
returns the position of the first found occurence of a specified value in a string
|
|
lastIndexOf()
|
returns the position of the last found occurence of a specified value in a string
|
|
replace()
|
searches for a match between a substring (or regex) and a string, and replaces the matched substring with a new substring
|
|
search()
|
searches for a match between a regex and a string, and returns the 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
|
|
substr()
|
extracts the characters from a string, beginning at a specified start position, and through the specified number of character
|
|
substring()
|
extracts the characters from a string, between two specified indices
|
|
toLowerCase()
|
converts a string to lowercase letters
|
|
toUpperCase()
|
converts a string to uppercase letters
|
|
trim()
|
removes whitespace from both ends of a string
|
|
valueOf()
|
returns the primitive value of a String object
|
|
toString()
|
returns the value of a String object
|
|
Method
|
Description
|
|
abs(x)
|
returns the absolute value of x
|
|
round(x)
|
rounds x to the nearest integer
|
|
ceil(x)
|
returns x, upwards to the nearest integer
|
|
floor(x)
|
returns x, rounded downwards to the nearest integer
|
|
exp(x)
|
returns the value of Ex
|
|
log(x)
|
returns the narural logarithm (base E) of x
|
|
max(x, y, z, ...)
|
returns the number with the highest value
|
|
min(x, y, z, ...)
|
returns the number with the lowest value
|
|
pow(x, y)
|
returns the value of x to the power of y (xy)
|
|
sqrt(x)
|
returns the square root of x
|
|
random()
|
returns a random number between 0 and 1
|
|
sin(x)
|
returns the sine of x (x in radians)
|
|
cos(x)
|
returns the cosine of x (x in radians)
|
|
tan(x)
|
returns the tangent of an x
|
|
Method
|
Meaning
|
Units
|
|
getFullYear()
|
4-digit year
|
2000, 2001, ...
|
|
getMonth()
|
month no.
|
0 - 11
|
|
getDate()
|
dat of month
|
0 - 31
|
|
getHours()
|
hour no.
|
0 - 23
|
|
getMinutes()
|
minute no.
|
0 - 59
|
|
getSeconds()
|
second no.
|
0 - 59
|
|
Method
|
Description
|
|
concat()
|
joins two or more arrays, and returns a copy of the joined array
|
|
indexOf()
|
search the array for an element and returns its position
|
|
join()
|
joins all elements of an array into a string
|
|
lastIndexOf()
|
search the array for an element, starting at the end, and returns its position
|
|
pop()
|
removes the last element of an array, and returns that element
|
|
push()
|
adds new elements to the end of an array, and returns the new length
|
|
reverse()
|
reverses the order of the elements in an array
|
|
shift()
|
removes the first element of an array, and returns that element
|
|
sort()
|
sorts the elements of an array
|
|
toString()
|
converts an array to a string, and returns the result
|
|
valueOf()
|
returns the primitive value of an array
|
|
Method
|
Description
|
|
toExponential(x)
|
converts a number into an exponential notation
|
|
toFixed(x)
|
formats a number with x numbers of digits after the decimal point
|
|
toPrecision(x)
|
formats a number to x length
|
|
toString()
|
converts a Number object to a string
|
|
valueOf()
|
returns the primitive value of a Number object
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.