Message from JavaScript discussions

June 2017

— In the end, all a Symbol is, is an unknowable value. What use that is, is up to interpretation


It is basically a UUID no one can directly observe, but can still get a reference to if it is assigned to an object

— More just out of the way of casual observation

— It is non enumerable, which can be useful

— Another thing you could do with the function syntax that you CAN'T do with class syntax is to 'redirect' the caller to use new if they omitted it:

function MyClass() {
if (!(this instanceof MyClass)) {
return new MyClass();
// ...

class syntax doesn't give you this at all

Message permanent page

— Will return an object that is always instanceof MyClass

— Pretty awesome

— Wow

— That is sick!!

— A few builtins use this

— Including Symbol it seems

— That is like a factory-constructor hybrid