I'm reading this great book called Eloquent JavaScript but I'm confused by the use of the word "binding" in this example:
It is possible to include symbol properties in object expressions and classes by using square brackets around the property name. That causes the property name to be evaluated, much like the square bracket property access notation, which allows us to refer to a binding that holds the symbol.
let stringObject = {
[toStringSymbol]() { return "a jute rope"; }
};
console.log(stringObject[toStringSymbol]());
// → a jute rope
As I understand it (so far in my JS journey), "binding" relates to specifying which this
or object context in which a function operates. See here.. Binding is perhaps something related to context. That is why we have .bind()
.
But in this example we are binding something else (a method whose key is a symbol). Does binding
just mean attaching a property (primitive or method) to an object?