--

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; }
};
}

--

--

David Rodenas PhD
David Rodenas PhD

Written by David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.

No responses yet