symbol lookup performance

In javascript symbols can be used as keys to store private values like so: sig = Symbol "self" ob = {} ob.self = null ob[sig] = null symbol_look = function() { ob[sig] = Math.random() } normal_look = function() { ob.self = Math.random() } The private value self is accessible publicly while the one using sig is not, I was curious to know if there was significant performance penalty for using symbols....

January 4, 2023 · 1 min ·