1
00:00:00,120 --> 00:00:06,770
We've worked a bit with JavaScript strings already a string simply stores a series of characters.

2
00:00:07,050 --> 00:00:16,230
For example John Smith a string can be any text inside quotes you can use both single and double quotes.

3
00:00:17,250 --> 00:00:18,660
Let's take a look at an example

4
00:00:22,180 --> 00:00:23,350
in this script.

5
00:00:23,560 --> 00:00:32,130
We have two variables student name 1 and student name two each variable contains the full name of an

6
00:00:32,130 --> 00:00:41,990
individual the first variable contains John Smith and the second contains Roy Martin as you can see

7
00:00:42,050 --> 00:00:50,210
the first name is separated from the last name by a single space the first variable is nested inside.

8
00:00:50,240 --> 00:00:52,130
Double quotes.

9
00:00:52,370 --> 00:00:55,260
The second is nested in single quotes.

10
00:00:55,520 --> 00:00:56,810
Both methods will work.

11
00:01:00,690 --> 00:01:09,530
We have output in each string on an individual line and we've separated each variable using the brake

12
00:01:09,530 --> 00:01:15,870
tag you might recall the brake tag from the H2 M.L.S. of this course.

13
00:01:15,900 --> 00:01:19,590
Let's take a look at what this script looks like in our web browser

14
00:01:26,250 --> 00:01:36,040
here we can see each variable output it on its own line in our web browser.

15
00:01:36,040 --> 00:01:51,090
Now let's take a look at another example to illustrate the use of quotes inside of a string.

16
00:01:51,220 --> 00:01:53,220
We now have three variables.

17
00:01:53,380 --> 00:01:56,290
Line one line two in line three

18
00:01:59,100 --> 00:01:59,950
in line 1.

19
00:01:59,970 --> 00:02:03,350
We use an apostrophe in the first word.

20
00:02:03,390 --> 00:02:06,080
This is acceptable in JavaScript.

21
00:02:06,360 --> 00:02:09,070
Variable line 2 in line 3.

22
00:02:09,150 --> 00:02:13,730
Show the correct method of using quotes inside a string.

23
00:02:13,740 --> 00:02:18,120
You can use quotes as long as they don't match the quotes surrounding the string

24
00:02:22,550 --> 00:02:25,240
so for variable line 2.

25
00:02:25,670 --> 00:02:33,540
We've used double quotes surrounding the string and for that reason single quotes around the name is

26
00:02:33,560 --> 00:02:37,690
Xavier online 3.

27
00:02:38,020 --> 00:02:44,020
We view single quotes surrounding the string and for that reason we've had to use double quotes around

28
00:02:44,020 --> 00:02:45,310
the name exhibitor

29
00:02:48,090 --> 00:02:56,560
we'll save our file and previewed in our web browser and we can see that everything works correctly.

30
00:02:56,760 --> 00:03:05,610
We can see the apostrophe in the first line we can see our single quotes in our double quotes output

31
00:03:05,610 --> 00:03:08,140
it from variable 2 and 3.
