Use valueOf instead of toString, it's designed for that.
Your tactic can be problematic if you just store the value, like myArea1 = object.area. This will store the function and I don't think you'll be able to get your area back. Better push everyone to upgrade their browser :)
zaach You're right, I wouldn't rely on this in production.
But you bring up an interesting point! myArea1 would indeed store a *reference* to the area function and, when coerced, would continue providing the current area of that object. It's like a detached getter, but is still bound to the object thanks to a closure. Useful? Probably not. But cool!
But you bring up an interesting point! myArea1 would indeed store a *reference* to the area function and, when coerced, would continue providing the current area of that object. It's like a detached getter, but is still bound to the object thanks to a closure. Useful? Probably not. But cool!