Symbol : primitive type
Why intordued : diifuclt to make unique key with the help of primitive type like string , nan , undefined , number etc. Symbol helps in defining uniques key everytime it is defined
// definig String - primitive type
let str1 = "this";
let str2 = "this";
console.log(str1 === str2);
// defining symbol - primitve type
let sym1 = Symbol("this");
let sym2 = Symbol("this");
// console.log(typeof sym1);
console.log(sym1 === sym2);
0 Comments