Closed mattfbacon closed 3 years ago
This applies to Creational/builder.js
.
yeah but in this case, it's fine if they are enumerable and changeable though thanks for the suggestion, I did not know about the defineProperty method. I think builder.js demonstrates the essence of builder pattern fine with or without it.
It's just that a class with the same fields wouldn't be enumerable so since you're trying to simulate multiple inheritance (at least from what I can tell) it's not actually the same thing.
In case you don't want these attributes (that would probably be present in a class) to be, e.g., enumerable, you can use Object.defineProperty with
enumerable: false
. There is also a read-only attribute, as well as getters and setters.