Declaring a symbol doesn't require a new keyword:

let mySymbol = Symbol();

We can also provide a string when creating a symbol; it acts as a label for the symbol and can help with debugging.

let anotherSymbol = Symbol('test2');

Equality

Symbols are unique, even when providing a string for them:

Symbol('a') === Symbol('a')  // false

Hides Information

Symbols can be used to hide information:

let mySymbol = Symbol('answer');
let obj = {
  x: 24,
  [mySymbol]: 42
}
console.log(obj.x); // 24
console.log(obj.mySymbol); // undefined

console.log(obj[mySymbol]); // 42

mySymbol.toString()  // "Symbol(answer)"

One would need to keep mySymbol variable around in order to access the second obj property.

let obj = {
	x: 24,
  [Symbol("answer")]: 42
}
console.log(obj[Symbol.for("answer")]);  // undefined

Danger No String Conversation

Unfortunately, there is no direct string conversion for symbols - an `undefined` is returned when conversion is required:

let mySymbol = Symbol('answer');
console.log(mySymbol);  // undefined

Further reading