How do getter or setter works on object in javascript ?
i.e.
In python if I call a nonexistent method on an object I could intercept the call via getter and setter and in turn return from getter and setter.
How do I do similar functionality in JavaScript ?
https://github.com/Flotype/now/blob/master/lib/client/now.js implements this functionality somehow. I didn’t understand the trick. can anyone explain ?
Creating the same functionality is virtually impossible in Javascript. My best guess would be something like this:
You can call this function on any object you like using this syntax:
It’s not the best solution but I don’t think there’s a better way.