1 00:00:01,440 --> 00:00:03,420 Welcome back to Learn to Code and JavaScript. 2 00:00:04,050 --> 00:00:06,380 Next, we're going to talk about primitive data types. 3 00:00:07,620 --> 00:00:09,330 So what are the primitive data types? 4 00:00:10,680 --> 00:00:16,020 So one is called undefined and we'll see an example that it just means something has no definition. 5 00:00:18,890 --> 00:00:22,610 Bullion is a data type that can be true or false. 6 00:00:24,720 --> 00:00:28,110 Numbers can be whole numbers or decimal numbers. 7 00:00:29,050 --> 00:00:30,340 And they have a certain range. 8 00:00:32,020 --> 00:00:36,190 Strings are set of zero more characters like Hello, World is a strange. 9 00:00:37,760 --> 00:00:43,820 Big event is an arbitrary precision, no, you using things like cryptography and things like that where 10 00:00:43,820 --> 00:00:45,710 you need really, really long numbers. 11 00:00:48,460 --> 00:00:54,460 And several produces a unique value of these we're only going to be focusing on undefined billion number 12 00:00:54,460 --> 00:00:54,970 and string. 13 00:00:58,980 --> 00:01:08,280 So literal data versus variables, a literal value like the number two, can only be used once. 14 00:01:08,290 --> 00:01:15,600 So you put it in the program, you say Castletown log too, and that too, you can repeat it, but it's 15 00:01:15,600 --> 00:01:24,150 a different version of that to so undefined has a value of undefined boolean. 16 00:01:24,540 --> 00:01:28,140 A literal value could look like true numbers. 17 00:01:28,140 --> 00:01:31,610 It could look at one zero twenty two point five six seven. 18 00:01:32,340 --> 00:01:38,550 And if you haven't seen this before, it looks so different to point to five, six, seven E one. 19 00:01:39,300 --> 00:01:45,810 The E is an exponential notation or scientific notation, which means times 10 to the first. 20 00:01:46,840 --> 00:01:50,650 So that number and twenty two point five, six, seven are equivalent. 21 00:01:53,560 --> 00:01:58,660 Strength, we've seen some of these before, however, with Dovecote, good Bárbara with single quotes. 22 00:01:59,640 --> 00:02:06,210 Twelve point twenty two in quotes is a string, not a number, true in quotes is a string, not a no. 23 00:02:12,220 --> 00:02:15,060 A variable stores value could be used again. 24 00:02:17,600 --> 00:02:19,980 And for primitive, dated variables are immutable. 25 00:02:20,000 --> 00:02:24,790 And what this means is that if you cannot really be changed, you just get a new copy of it. 26 00:02:29,740 --> 00:02:36,820 Variables are stored in computer memory is one or more bytes and a bite has eight bits of zeros or ones. 27 00:02:38,180 --> 00:02:42,220 So, for example, a number is two bites, I'm sorry. 28 00:02:42,440 --> 00:02:49,370 Number is, I think eight bites and there eight bites of zeros and ones, a character and a string of 29 00:02:49,370 --> 00:02:50,060 two bites. 30 00:02:51,460 --> 00:02:53,800 That has a representation of that character. 31 00:02:56,490 --> 00:03:04,650 Variable scope variables are defined in a scope, and we talk about the scope of a function in the previous 32 00:03:04,650 --> 00:03:08,070 structure, which is the space between curly braces. 33 00:03:09,410 --> 00:03:13,960 We want to avoid is global scope because then you can have like side effects and we'll take a look at 34 00:03:13,960 --> 00:03:14,230 that. 35 00:03:16,550 --> 00:03:23,480 Some keywords, VA, which is an old way to declare variables and JavaScript, but it declares it in 36 00:03:23,480 --> 00:03:24,800 global scope, don't use it. 37 00:03:25,710 --> 00:03:31,890 You'll see it being used, but you should not use it because it's been replaced by LET, and that lets 38 00:03:31,890 --> 00:03:38,630 you define a new variable or contract which allows you to declare a variable that cannot be reassigned, 39 00:03:38,650 --> 00:03:39,420 a new value. 40 00:03:43,910 --> 00:03:49,220 JavaScript uses dynamic variable definition so a variable can have different types, so you could say 41 00:03:49,220 --> 00:03:50,810 let X equals three. 42 00:03:50,870 --> 00:03:55,190 That's the way to define it, variable X, that's the number that has the value of three. 43 00:03:56,570 --> 00:03:58,640 But you can turn right around and say X equals hello. 44 00:03:59,600 --> 00:04:00,280 As a stray. 45 00:04:01,130 --> 00:04:03,860 So now X is a string, not a no. 46 00:04:06,290 --> 00:04:07,970 And then you can say X equals true. 47 00:04:11,090 --> 00:04:16,640 So some information about scope and you've also seen this word at the top, secret mode you stripped. 48 00:04:17,580 --> 00:04:22,470 And look at a definition of that, but what it does is prevents use of undeclared variables. 49 00:04:24,140 --> 00:04:31,430 And then scope, as I mentioned, is the boundaries of the left, curly brace and right curly brace 50 00:04:31,430 --> 00:04:32,810 for variables are known and defined. 51 00:04:33,410 --> 00:04:35,060 So we'll look at a couple of examples of that.