Created
January 23, 2018 14:40
-
-
Save jasuperior/138866567091e18705c2a27244fbdf02 to your computer and use it in GitHub Desktop.
aSymboler - A common interface for using symbol property values to create private keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s = new Proxy({},{ | |
get(target, prop){ | |
if(!target[prop]) target[prop] = Symbol(); | |
return target[prop]; | |
}, | |
set(){ | |
return false; | |
} | |
}) | |
var x = {}; | |
x[s.a] = 6 | |
console.log(x[s.a]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment