1 00:00:00,620 --> 00:00:00,980 Here. 2 00:00:00,980 --> 00:00:06,290 You can see I opened my Visual Studio Code editor, and I also create a HTML file. 3 00:00:06,320 --> 00:00:10,310 And I open this HTML file using live server extension in this browser. 4 00:00:11,220 --> 00:00:13,380 First I'm going to type script tag. 5 00:00:14,510 --> 00:00:17,210 Inside the script tag, I am going to create a symbol. 6 00:00:17,840 --> 00:00:19,730 So I'm going to create a variable. 7 00:00:20,610 --> 00:00:26,760 Let ID equal to S should be capital symbol. 8 00:00:27,090 --> 00:00:29,370 Let's print this symbol in our console. 9 00:00:29,910 --> 00:00:37,470 So I'm going to type console dot log inside the parentheses id. 10 00:00:38,070 --> 00:00:41,760 If I save this file you can see in my console it print. 11 00:00:41,790 --> 00:00:42,900 It's a symbol. 12 00:00:43,320 --> 00:00:46,350 And I'm going to assign a identifier to the symbol. 13 00:00:46,350 --> 00:00:47,790 So I'm going to type hello. 14 00:00:48,880 --> 00:00:51,880 It may be string, may be number, whatever. 15 00:00:52,390 --> 00:00:54,730 And if I set this file you can see my console. 16 00:00:54,730 --> 00:00:55,570 It's print. 17 00:00:55,600 --> 00:00:56,230 Hello. 18 00:00:56,380 --> 00:00:58,150 And if I show you the data type. 19 00:00:58,150 --> 00:00:59,920 So I'm going to duplicate this line. 20 00:01:00,710 --> 00:01:01,910 And I'm going to print. 21 00:01:02,940 --> 00:01:05,190 Type of ID. 22 00:01:05,940 --> 00:01:08,910 And if I save this file, you can see it's been symbol. 23 00:01:10,110 --> 00:01:12,450 Symbols mean one unique value. 24 00:01:12,880 --> 00:01:14,460 Let's try to prove it. 25 00:01:14,490 --> 00:01:16,230 How it is a unique value. 26 00:01:16,900 --> 00:01:21,970 So I'm going to duplicate this line and change the name ID to. 27 00:01:22,210 --> 00:01:25,840 You can see it's looking same and their value is same. 28 00:01:26,290 --> 00:01:29,680 But if I compare this to variable it's return false. 29 00:01:29,830 --> 00:01:31,150 Let's compare it. 30 00:01:32,920 --> 00:01:36,940 ID equals to equals to id two. 31 00:01:37,420 --> 00:01:40,840 If I save this file you can see it returns false. 32 00:01:41,350 --> 00:01:44,770 Its mean these two variables values are not same. 33 00:01:44,990 --> 00:01:47,740 Its look pretty similar but it is not same. 34 00:01:47,920 --> 00:01:51,170 But if we use string let me show you that. 35 00:01:51,190 --> 00:01:52,870 So I'm going to duplicate this line. 36 00:01:53,170 --> 00:02:00,460 And I'm going to change the name as tr one and str two. 37 00:02:01,190 --> 00:02:03,500 Now they are string, not symbols. 38 00:02:03,500 --> 00:02:05,480 So I'm going to remove this symbol keyword. 39 00:02:06,820 --> 00:02:08,380 And also I'm going to remove this one. 40 00:02:09,290 --> 00:02:11,540 And now I'm going to compare this to value. 41 00:02:11,750 --> 00:02:22,370 So inside console dot log section I'm going to type T, r1 and str2 and I'm going to comment out this 42 00:02:22,370 --> 00:02:22,850 one. 43 00:02:23,540 --> 00:02:29,840 If I save this file you can see it returned true because in that case they are not symbol. 44 00:02:30,170 --> 00:02:31,130 They are string. 45 00:02:31,880 --> 00:02:32,930 And two variables. 46 00:02:32,930 --> 00:02:34,040 Values are same. 47 00:02:34,490 --> 00:02:36,110 They are not unique value. 48 00:02:36,320 --> 00:02:41,900 One thing remember we cannot use symbol value directly in our document. 49 00:02:42,530 --> 00:02:43,790 Let me show you that. 50 00:02:43,790 --> 00:02:45,370 So I'm going to remove this lines. 51 00:02:45,440 --> 00:02:47,210 I don't need this lines for now. 52 00:02:47,910 --> 00:02:49,710 And also I'm going to remove these lines. 53 00:02:50,550 --> 00:02:55,050 As I say, we cannot print symbol value in our document. 54 00:02:55,290 --> 00:02:56,760 If I try to print. 55 00:02:56,790 --> 00:02:58,270 So I'm going to use a alert. 56 00:02:59,000 --> 00:03:03,210 Alert inside the parentheses I'm going to print ID. 57 00:03:03,840 --> 00:03:06,270 If I run this code it's written error. 58 00:03:06,360 --> 00:03:07,830 So I'm going to save this code. 59 00:03:08,220 --> 00:03:10,080 And you can see type error. 60 00:03:10,530 --> 00:03:14,850 And also it print cannot convert a symbol value to a string. 61 00:03:15,030 --> 00:03:22,470 If you want to convert symbol value into a string then you need to use some method to convert symbol 62 00:03:22,470 --> 00:03:23,550 value into a string. 63 00:03:23,760 --> 00:03:25,080 Let me show you that. 64 00:03:25,440 --> 00:03:30,990 So we need to use two string method id dot two string. 65 00:03:31,350 --> 00:03:35,370 Using this method we can convert symbol variable into a string. 66 00:03:35,550 --> 00:03:38,790 If I save this file now, it's work properly. 67 00:03:38,820 --> 00:03:40,970 You can see in my alert symbol. 68 00:03:40,980 --> 00:03:41,640 Hello. 69 00:03:42,090 --> 00:03:46,290 So we need to use two string method to convert symbol into a string. 70 00:03:46,710 --> 00:03:50,070 And then we can use this symbol value in our document. 71 00:03:50,370 --> 00:03:55,230 And if you want to see the exact value of symbol then we need to use a different method. 72 00:03:55,260 --> 00:03:57,960 In that case we do not use two string method. 73 00:03:57,960 --> 00:04:04,470 So I'm going to remove it and I'm going to type id dot description. 74 00:04:06,040 --> 00:04:09,100 It's a not a function, so we don't need to use round braces. 75 00:04:09,890 --> 00:04:11,510 It is just a simple method. 76 00:04:11,840 --> 00:04:15,230 So if I save this file, you can see in my alert section. 77 00:04:15,230 --> 00:04:16,310 Now it is just print. 78 00:04:16,340 --> 00:04:18,660 Hello means our message. 79 00:04:18,680 --> 00:04:23,960 In the next part of this video I am going to show you how can we use symbol into a object?