Hello friends, nice to see you back.
In this tutorial we are going to learn about symbol.
We already know about data type in JavaScript.
Specially we have seven type of data type string, number, boolean, array, object, null and undefined.
But a new data type has been added to this list which is symbol.
And in this video we are going to learn about symbol.
But before we learn about symbol, let's take a overview to our old data types.
Suppose I have a variable name a and if we assign this variable and insert the double quotes or single
quotes, if I provide any value, then we call it a string and it doesn't matter.
Is it alphabetic or numeric?
It's mean.
A data type is string.
Similarly, if we assign a numeric value without quotes, then we call it number data type.
But if I provide true or false without quotation, it's mean.
It's a boolean data type.
But if I add multiple value in our A variable, then we can use array data type.
For this we need to use square braces.
And then we can use multiple value.
But if I want to add key and value pair then we can use object data type.
And if I assign null to this variable then we call it null data type.
And if we do not define any value to this variable in that case we can call it undefined.
I know if you are in this course, you already know about it, just want to revise once again.
But in this video we are going to understand a new data type symbol.
When you want to use symbol data type, you need to take variable and you need to assign with a symbol
method.
And remember this should be capital and we need to use round basis.
After that and insert this symbol we can place any value.
It may be numeric value or string value something like that.
And we call this string symbol identifier or description.
And it's always a unique value.
I want to say we cannot assign the same value to other symbol.
Suppose I take another variable b and I'm going to provide the same value.
As you can see, a and b variable value is same.
Maybe you can think their value is same.
So if we try to compare them it returned true.
But this is not going to happen.
If we compare this to variable its return false.
Their value looks same, but they are not same because symbols values are unique and if we try to compare
it, it returns false when we need to use unique value to our program.
In that case, we can use symbols.
So let's start the practical and try to explore more about symbols.