Is it possible to assign a self-invoking function module to a variable so that calling the variable will trigger the function without using the () operator? I am looking for the variable to always hold the latest value based on the code inside the function module.
The code might look like this:
count = 0
var x = function(){ return count }();
alert x; // should output 0
count = 7
alert x; // should output 7
Thank you