3 ms·
TFB(ook) by TFA(uthor) of TFA(rticle) discusses the issues with open recursion, and describes a pattern for using ECMAScript 2015 symbols to address this exact
by braythwayt 11y ago
TFB(ook) by TFA(uthor) of TFA(rticle) discusses the issues with open recursion, and describes a pattern for using ECMAScript 2015 symbols to address this exact problem:
const books = Symbol(“books”);
const BookCollector = {
addToCollection (name) {
this.collection().push(name);
return this;
},
collection () {
return this[books] || (this[books]= []);
}
};