Some more functions of String Object in JavaScript. These functions can be used to change the styles of fonts in the specified string. You can concatenate one or more strings, change the font size, color etc.

JavaScript String Function Examples

Consider the same string we used in the previous article JavaScript String Object Functions-1:

var myString = new String();
myString = "JavaScript String Function";

String conact Function

Adds the string passed to the end of main string.

Syntax
stringObject.cancat([string]);
Example
document.write( myString.concat(" Concat Example") );
Output

JavaScript String Function Concat Example

String fixed Function

Displays the string in Teletype font style.

Example
document.write( myString.fixed() );

String fontColor Function

Displays the string in specified color.

Syntax
stringObject.fontColor([colorname | colorhexcode]);
Example
document.write( myString.fontcolor("#ff0000") );
Output

JavaScript String Function

String fontsize Function

Displays the fonts in the specified font size.

Syntax
stringObject.fontsize([size]);
Example
document.write( myString.fontsize("18") );

String italics Function

Displays the string fonts in italics

Example
document.write( myString.italics() );
Output

JavaScript String Function

String link Function

Creates the link on string by binding it with the specified URL.

Example
document.write( myString.link("http://www.ezineasp.net") );

String sub Function

Displays the string in subscript form.

Example
document.write( myString.sub() );

String sup Function

Displays the string in superscript form.

Example
document.write( myString.sup() );

String toLowerCase Fucntion

Displays the string in lower case.

Example
document.write( myString.toLowerCase() );
Output

javascript string function

String toUpperCase Function

Displays the string in Upper case.

Example
document.write( myString.toUpperCase() );
Output

JAVASCRIPT STRING FUNCTION

Continue to next tutorial: Javascript Replace String Function to learn how to replace specified pattern in a string.

Recent JavaScript Tutorials

Javascript FSO ShortPath property

Javascript FileSystemObject (FSO) provides a ShortPath property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Path Property

Javascript FileSystemObject (FSO) provides the Path property that can be accessed through the file object or folder object returned by the GetFile or GelFolder method

Javascript FSO Type property

Javascript FileSystemObject (FSO) provides a Type property that can be accessed through file object or folder object returned by the GetFile or GetFolder method

Javascript FSO ShortName property

Javascript FileSystemObject (FSO) provides a ShortName property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Name Property

Javascript FileSystemObject (FSO) provides a Name property that can be accessed using file object or folder object.