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

1

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

paint('green');
paint('red');
paint('blue');
paint('grey');
2

Click Check source code.

3

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?