The lazy-loading property pattern in JavaScript

1 · Nicholas C. Zakas · April 20, 2021, 3:22 p.m.
Traditionally, developers have created properties inside of JavaScript classes for any data that might be needed within an instance. This isn’t a problem for small pieces of data that are readily available inside of the constructor. However, if some data needs to be calculated before becoming available in the instance, you may not want to......