What are strings and why should I care?

A string is what is used in computer programs to store text.

A string is simply a sequence of characters.

In the programming language that we use here at Nilwen, JavaScript, strings can either be enclosed by single or double quotes.

An example of a string enclosed by single quotes:

'this is a string'

An example of a string enclosed by double quotes:

"this is another string"

Let's try it out


Type the following into the the box where it says Enter source code here:


Click Check source code.


Click Run!.

So what is happening here?

The function paint() is taking one argument - a string containing the name of a color.

When called, paint() will paint the box in the color given by the argument.

Next lesson:
String escaping
What is string escaping?