Example 1 : Create symboll
<script>
let a = Symbol();
console.log(typeof a)
</script>
Example 2 : proof (unique identify of symboll)
<script>
let a = Symbol("Ram");
let b = Symbol("Ram");
console.log(a==b)
</script>
Example 3 : out put by alert
<script>
let a = Symbol("Ram");
alert(a.toString())
</script>
Example 4 : access of symboll value using description keyword
<script>
let a = Symbol("Ram");
console.log(a.description);
alert(a.description)
</script>
Example 5 : Add Symool in object property and his value
<script>
let name = Symbol("name2")
let myobj = {
name : "Ramesh Kumar",
age : 25,
city : "Delhi"
}
myobj[name] ="Suresh"
console.log(myobj)
</script>