es6 Symbol
let s = Symbol() console.log(typeof s) let foo = Symbol('foo') let bar = Symbol('bar') console.log(foo); console.log(bar); console.log(foo === bar) //false let foo2 = Symbol('foo'); console.log(foo.toString() == foo2.toString())
//用法 const a = {} const mySymbol = Symbol() a[mySymbol] = 'hello' console.log(a[mySymbol])