1 00:00:00,550 --> 00:00:07,060 Welcome back, this is lesson five on Simbel data types, these are relatively new, primitive data 2 00:00:07,060 --> 00:00:10,660 type that was added in twenty fifteen to JavaScript. 3 00:00:11,550 --> 00:00:18,670 Invoking the function symbol and this is a specific class, produces an anonymous, unique value. 4 00:00:18,990 --> 00:00:21,380 So this is a very, very interesting data type. 5 00:00:22,200 --> 00:00:30,510 Basically, you're going to use this to create a specific I.D. that you can use for any type of unique 6 00:00:30,510 --> 00:00:31,410 value purpose. 7 00:00:31,680 --> 00:00:35,470 OK, so let's take a look at this type of code here and see what it does. 8 00:00:36,150 --> 00:00:44,160 We're going to create a simple one and simple to notice that they're tied to the same type of information, 9 00:00:44,640 --> 00:00:47,520 the same description right here inside the quotes. 10 00:00:48,390 --> 00:00:50,820 And otherwise, these look exactly the same. 11 00:00:51,630 --> 00:00:59,310 But they're not going to be the same value because what symbol does is create a unique value for each 12 00:00:59,460 --> 00:00:59,880 time. 13 00:01:00,300 --> 00:01:01,560 So we'll show you what that looks like. 14 00:01:03,720 --> 00:01:15,380 OK, so we'll just let symbol one equal symbol and we're going to give this a description, OK? 15 00:01:17,340 --> 00:01:19,530 And the description is totally optional. 16 00:01:19,710 --> 00:01:20,940 It's not necessary at all. 17 00:01:21,930 --> 00:01:25,680 We're going to use these descriptions just for the purpose of showing you what's going on here. 18 00:01:27,720 --> 00:01:30,110 So we wanted to see whether or not these are the same. 19 00:01:31,800 --> 00:01:41,190 So we'll do a console log and we'll say SIM one is exactly the same as seem to OK. 20 00:01:41,760 --> 00:01:43,090 Now let's just see what happens. 21 00:01:44,520 --> 00:01:45,960 It's going to return false. 22 00:01:45,990 --> 00:01:46,730 Interesting. 23 00:01:47,130 --> 00:01:52,650 OK, and obviously what that means is if we check for the opposite, it's going to return. 24 00:01:52,650 --> 00:01:52,980 True. 25 00:01:53,710 --> 00:01:58,230 OK, are they even partially the same? 26 00:01:59,850 --> 00:02:00,240 No. 27 00:02:01,720 --> 00:02:05,970 OK, now let's see if we can actually see what this value shows. 28 00:02:07,290 --> 00:02:13,620 OK, when you consider this, it's not going to give you necessarily what you expect. 29 00:02:14,220 --> 00:02:17,130 It's going to give you this special symbol. 30 00:02:18,260 --> 00:02:24,770 Value and obviously, if we do the same thing here, it's going to look the same, but these are actually 31 00:02:24,770 --> 00:02:25,610 separate values. 32 00:02:25,640 --> 00:02:28,250 Remember, we checked to see if they were the same and they're not. 33 00:02:28,940 --> 00:02:34,310 So if we want to actually get them as the same value, then we'd have to convert them to string's. 34 00:02:35,480 --> 00:02:38,150 So if we convert both of them to string's. 35 00:02:39,410 --> 00:02:48,490 We can do like this and then check it, those are true because those both would show up as just symbols, 36 00:02:48,490 --> 00:02:50,590 simple like that. 37 00:02:51,400 --> 00:02:54,970 But what's nice about these is they create these unique values. 38 00:02:55,900 --> 00:03:05,740 Just like that, and if you wanted to access just the description you could by doing this so you can 39 00:03:05,740 --> 00:03:07,540 control just the description. 40 00:03:12,370 --> 00:03:15,350 And you get just the value that's there in the description. 41 00:03:15,370 --> 00:03:17,110 So, as you can see, I could change it. 42 00:03:19,220 --> 00:03:20,510 And it would change accordingly. 43 00:03:21,050 --> 00:03:23,930 OK, so let's change that back. 44 00:03:25,940 --> 00:03:28,960 Let's just for ease of understanding this, let's keep it that way. 45 00:03:32,890 --> 00:03:35,330 And then run that again, you can see symbolism. 46 00:03:35,890 --> 00:03:43,630 OK, so symbols are not used a lot, but you can use them as IDs in databases, as properties of objects, 47 00:03:43,900 --> 00:03:44,990 and we'll get into objects. 48 00:03:45,820 --> 00:03:47,640 OK, and that's it for DE.