EDtutorialspoint —— (searen eutorais, courses and ebooss.. SC*S
@ Home
> Coding Ground
D Jobs
[2 Whiteboard
® Tools
Number Methods
The Number object contains only the default methods that are part of every
object's definition.
Sr.No. Method & Description
constructor()
1 Returns the function that created this object's instance. By default
this is the Number object.
toExponential()
Forces a number to display in exponential notation, even if the
number is in the range in which JavaScript normally uses standard
notation.
toFixed()
3 Formats a number with a specific number of digits to the right of
the decimal.
toLocaleString()
4 Returns a string value version of the current number in a format
that may vary according to a browser's locale settings
5 toPrecision()°e tutorialspoint
toString()
Returns the string representation of the number's value.
valueOf()
Returns the number's value.
Boolean Methods
Here is a list of each method and its description.
Sr.No. Method & Description
toSource()
1 Returns a string containing the source of the Boolean object; you
can use this string to create an equivalent object.
toString()
2 Retums a string of either "true" or "false" depending upon the
value of the object.
3 valueor()
Returns the primitive value of the Boolean object.
String Methods
Here is a list of each method and its description.
Sr.No. Method & Description
1 charat()
Returns the character at the specified index.
charCodeat()
2 Returns a number indicating the Unicode value of the character at
the given index.
concat()
Combines the text of two strings and retums a new string°e tutorialspoint
10
11
12
13
14
15
occurrence of the specified value, or -1 it not found.
lastIndexOf()
Returns the index within the calling String object of the last
occurrence of the specified value, or -1 if not found.
localeCompare()
Returns a number indicating whether a reference string comes
before or after or is the same as the given string in sort order.
length()
Returns the length of the string.
match()
Used to match a regular expression against a string.
replace()
Used to find a match between a regular expression and a string,
and to replace the matched substring with a new substring.
search()
Executes the search for a match between a regular expression and
a specified string.
slice()
Extracts a section of a string and returns a new string
split()
Splits a String object into an array of strings by separating the
string into substrings.
substr()
Retums the characters in a string beginning at the specified
location through the specified number of characters.
substring()
Returns the characters in a string between two indexes into the
string.
toLocaleLowerCase()°e tutorialspoint
toLocaleUpperCase()
16 The characters within a string are converted to upper case while
respecting the current locale.
17__ tolowerCase()
Returns the calling string value converted to lower case.
1g toString()
Returns a string representing the specified object.
19 toUpperCase()
Retums the calling string value converted to uppercase.
29 Valuer)
Retums the primitive value of the specified object.
String HTML wrappers
Here is a list of each method which returns a copy of the string wrapped
inside the appropriate HTML tag
Sr.No.
Method & Description
anchor()
Creates an HTML anchor that is used as a hypertext target.
big()
Creates a string to be displayed in a big font as if it were in a
tag.
biink()
Creates a string to blink as if it were in a