JavaScript - Strings and Numbers and Concatenation:

Strings:

• are generally considered "word" information
• are surrounded by quotation marks
• could include some HTML
• are case sensitive
• Remember: you can't do math with strings
```3 examples of strings:  "I love fish. So do cats."   "<b>Hi</b>"   "2006"
```

Some JavaScript commands (like `prompt()`) need strings to work, and some commands don't work with strings.

Quotation marks in strings:

Because strings are usually surrounded by double quotation marks (like the ones around "this"), it causes a problem if you want to have a quotation mark inside the string.

This is not a problem:

```var hiswords = "He said he was hungry.";
```

BUT this IS a problem:
```var hiswords = "He said, "I'm hungry!"";
```

There are several ways you could get around this problem:

- The most correct and elegant is to place a \ in front of every internal " mark, like so:
```   var hiswords = "He said, \"I'm hungry!\"";
```
The browser will understand that each \" pair indicates an internal quotation mark, not the quotation mark at the beginning or end of the string.

- A kludgey way around the problem is to replace every internal " mark with a single quote (an apostrophe), like so:
```   var hiswords = "He said, 'I'm hungry!'";

```

Numbers / Values:

Numbers may be referred to as values in JavaScript and other languages
• are generally considered "number" information
• are never surrounded by quotation marks
• you can do math with them, like so:
```var x = 2 * 60;
var y = 3 + x;
// we know that y would equal 123
```
• A floating point number is a number that has a decimal point (it is a fraction). For example:     0.5     3.14159     -125.25

• An integer is a whole number (not a fraction). For example:     1     -3     155

Concatenation:

• is sticking different things together to make a unit
• is usually used to stick strings and variables together -- into a sentence, for example.
• uses this symbol: +
• in working with + and strings and variables, the plus sign sticks the strings and variables together (it does not do math with them)

How does JavaScript know when to concatenate with + and when to do math with +? Basically, JavaScript takes what you give it (string or number) as a precedent and then proceeds accordingly.

If you give JavaScript a string to work with, it will concatenate; if you give it only numbers, it will do math.

For example:

```If you give JavaScript the line:
var x = 2;
and then you give it the line:
var y = 3 + x;
you would expect the variable y to equal 5, and it would!

BUT, if you give JavaScript the line:
var x = "2";
the 2 is not a number but a string, and if then you had the line:
var y = 3 + x;
the variable y would contain this string: "32"
```