Categories:
Partners

Strings in JavaScript Part 1 (formatting text)

String manipulation is an important part of JavaScript programming, and having recently been reminded that I have yet to write a tutorial on it, this one comes as long overdue. In Part 1 of "Strings In JavaScript", I'll discuss how to format the look of a string using the language, such as make it bold, convert it to uppercase etc.

The String object

Before we officially proceed, it's important to realize the existence of a String Object in JavaScript, and how it is created- whenever a variable contains text. Take the following as an example:

var sitename="JavaScript Kit"

In the above, "sitename" is not only a variable, but an instance of the String object as well.