Apr 30, 2021
Regarding your comment ... “Crockford’s approach follows a more functional approach for writing JS.” ... there is exactly no single functional aspect in using functions as factories in order to create objects which still can access the local scope of their creation time.
It is simply function-based.
In JavaScript this is the single/sole way of creating objects (or instances via constructor functions regardless of class based or just pure) with encapsulated but accessible data/state.