Hey, that’s great news, Anes. (I’m also glad because I am short-on-time to help today). And thanks for telling us how you solved it. Yeah that sounds like a “scope” issue… sometimes an obstacle for noob OOPers like myself (and perhaps you, though you are doing objects pretty well, so far).
Badly said: “Scope” issues can cause a variable created in/by ONE “context”… to not be able to be seen/changed by another “scope context”. It’s part of OOP’s isolation of objects from each other, allowing “interfaces” (API’s) to be installed on objects/scopes. Public/private stuff.
An Object with an API/public-interface… can say/require “Only use THIS phone-line to communicate with me. Only use/change THESE exposed methods and properties, and maybe ONLY via get/set wrapper-methods. Don’t sneak into my windows or back doors.” When an object has these seemingly-strict “how to talk to me” rules/regulations, the object often becomes HIGHLY re-usable, project after project… forever. It gets put into your toolbag-of-useful-reusables.
Likely, you have a variable declaration from within ONE scope-context… trying too sneak-in the basement window of another context (something trying to read/change/set a prop, or call a method - from outside-of the scope where it was declared/created). One isolated object/scope… is not allowed to see/use the value/change done (attempted) by ANOTHER object/scope.
Damn, I’m a bad explainer. heh. I should learn it myself before I try to teach stuff.
But all is good good good! If you find some nice/easy tutorials about “OOP-scoping in JS… for Wingnuts”, drop a few URLs/links in this thread… as final post, perhaps. Then this thread (and your playgrounds) will be used for others to learn-from. This thread has a high edu-quotient.