Jul 10, 2022
Well, they are.
In fact, Object-Oriented Programming born from functions, with functions inside, that the parent variables values survived inside the closure, and they become the object state. Something like:
function makeObject() {
let myState; return {
set(x) { myState = x; }
get() { return myState; }
};
}