1
00:00:00,060 --> 00:00:05,370
Now we're at Section four, we're going to cover these primitive types, and that's string's numbers

2
00:00:05,370 --> 00:00:10,860
booleans, the basic building blocks of data that are in JavaScript.

3
00:00:12,540 --> 00:00:21,180
So lesson one is strings and properties, string primitives, these are basic, your basic text can

4
00:00:21,180 --> 00:00:23,010
use single quotes or double quotes.

5
00:00:23,040 --> 00:00:28,020
You can't mix and match, so you can't start with a single quotes and then end with a double quote or

6
00:00:28,020 --> 00:00:30,420
start with a double quote and end with a single quote.

7
00:00:31,350 --> 00:00:32,520
Now, one word of caution.

8
00:00:32,520 --> 00:00:36,540
String primitives and string objects are not the same.

9
00:00:36,550 --> 00:00:42,420
So there's a way that you can actually make a string object, which is similar to the way you use strings

10
00:00:42,420 --> 00:00:45,870
in other programming languages with the.

11
00:00:47,140 --> 00:00:54,010
Special keyword string, and then you put the word that you want to put in as a string in the parentheses,

12
00:00:54,040 --> 00:00:55,980
so that's using the new keyword as well.

13
00:00:57,310 --> 00:01:02,770
So I'm focused just on the primitive data types where if you just put something in between quotes,

14
00:01:02,770 --> 00:01:06,430
it will automatically be interpreted as a string in JavaScript.

15
00:01:07,090 --> 00:01:08,770
So let's take a look and see what that looks like.

16
00:01:15,040 --> 00:01:20,530
OK, so now let's take a look at some strings, so we're just going to make some string variables here.

17
00:01:21,640 --> 00:01:27,190
We're going to let string one string to string three.

18
00:01:28,360 --> 00:01:28,710
OK.

19
00:01:34,210 --> 00:01:39,140
And string one, we are going to just say that is equal to.

20
00:01:39,160 --> 00:01:44,110
So we're going to assign a value to it and we're going to say high

21
00:01:47,290 --> 00:01:48,130
string to

22
00:01:52,570 --> 00:01:56,620
we're going to assign this time we're going to use double quotes just to show you that you can use either.

23
00:01:57,860 --> 00:01:58,610
We're going to say.

24
00:02:02,910 --> 00:02:03,930
I'm new here.

25
00:02:10,280 --> 00:02:11,840
And then with our third string.

26
00:02:16,360 --> 00:02:24,190
Well, the sign my name is due to those at the front.

27
00:02:24,250 --> 00:02:25,390
My name is Pace.

28
00:02:26,200 --> 00:02:33,880
OK, so here are our three strings and basically this is how they work.

29
00:02:33,880 --> 00:02:35,550
We can do anything we want to with them.

30
00:02:36,010 --> 00:02:40,300
There are a number of different things we can do with strings, and I'm going to go over those in the

31
00:02:40,300 --> 00:02:40,960
next lesson.

32
00:02:41,770 --> 00:02:47,950
But the basics of strings here, basically, you can assign them to variables and you can also get their

33
00:02:47,950 --> 00:02:49,060
length if you want to.

34
00:02:49,390 --> 00:02:55,330
But let's just show you what happens when we use these so we can consider long strings very easily.

35
00:02:56,110 --> 00:02:59,950
You can just do this one at a time or all at once.

36
00:03:03,450 --> 00:03:08,850
OK, and again, it doesn't matter what your variables are named, but name them something appropriate

37
00:03:08,850 --> 00:03:11,010
to what the content is.

38
00:03:11,040 --> 00:03:14,820
So in this case, it's appropriate that I call them string because that's what I'm using.

39
00:03:17,150 --> 00:03:19,310
So let's go ahead and release.

40
00:03:21,530 --> 00:03:22,620
Hi, I'm new here.

41
00:03:22,640 --> 00:03:28,190
My name is Paice, I just printed them off one after the other, so it printed them all as the same

42
00:03:28,520 --> 00:03:33,940
line of text, basically the same as stringing them all together.

43
00:03:34,190 --> 00:03:35,540
And so that's why they call it a string.

44
00:03:35,540 --> 00:03:43,640
You're just making a sequence of characters and there's a property that you can access on strings,

45
00:03:43,970 --> 00:03:45,380
which is length.

46
00:03:48,390 --> 00:03:56,400
So string three length would be the length of that string, which is the number of characters in that

47
00:03:56,400 --> 00:03:56,760
string.

48
00:03:58,710 --> 00:04:07,230
So let's say that test it, I would expect to get one, two, three, four, five, six, seven, eight,

49
00:04:07,680 --> 00:04:16,230
nine, 10, 11, 12, 13, 14, 15, 16, 17, 17 is how many characters that we have in there.

50
00:04:16,230 --> 00:04:18,270
It counts empty spaces as well.

51
00:04:19,350 --> 00:04:21,000
Let's go and refresh and see if that's right.

52
00:04:22,260 --> 00:04:26,430
Yep, 17, so that's how many characters we have in the string.

53
00:04:26,880 --> 00:04:31,700
OK, so that's our first lesson on strings for JavaScript and we'll see you in the next one.
