JavaScript String Object

previous next


The String object is used to manipulate a stored piece of text.


String Object Methods

Method

Description

anchor() Creates an HTML anchor
big() Displays a string in a big font
blink() Displays a blinking string
bold() Displays a string in bold
charAt() Returns the character at a specified position
charCodeAt() Returns the Unicode of the character at a specified position
concat() Joins two or more strings
fixed() Displays a string as teletype text
fontcolor() Displays a string in a specified color
fontsize() Displays a string in a specified size
indexOf() Returns the position of the first occurrence of a specified string value in a string
italics() Displays a string in italic
lastIndexOf() Returns the position of the last occurrence of a specified string value, searching backwards from the specified position in a string
link() Displays a string as a hyperlink
match() Searches for a specified value in a string
replace() Replaces some characters with some other characters in a string
search() Searches a string for a specified value
small() Displays a string in a small font
split() Splits a string into an array of strings
strike() Displays a string with a strikethrough
sub() Displays a string as subscript
substr() Extracts a specified number of characters in a string, from a start index
substring() Extracts the characters in a string between two specified indices
sup() Displays a string as superscript
toLowerCase() Displays a string in lowercase letters
toUpperCase() Displays a string in uppercase letters
toSource() Represents the source code of an object
valueOf() Returns the primitive value of a String object

 


String Object Properties

Property

Description

constructor A reference to the function that created the object
length Returns the number of characters in a string
prototype Allows you to add properties and methods to the object

 


Try it

To see how HTML and JavaScript work, you can only push the submit button, or you can make your own HTML and JavaScript code.

           

 


previous next