loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
let vowel = Symbol();
let letter = Symbol("Letter");

console.log(typeof(vowel));
console.log(typeof(letter));
console.log(vowel.toString());
console.log(letter.toString());

// Create another symbol with the same description
let character = Symbol("Letter");

// Symbols are never the same, even if they use the same description 
if (letter == character) { 
   console.log('letter == character is True');
} else {
  console.log('letter == character is False');
}

if (letter === character) { 
   console.log('letter === character is True');
} else {
  console.log('letter === character is False');
}

// Use symbols as Object keys 
let config = {}
config[vowel] = "A";
config[letter] = "B";
config[character] = "C";

console.log(config);
Native Browser JavaScript