Hi,
Is there a way to make one property an alias for another? This would
mean that if the value of the original is changed then so is the value
of the alias. I tried the following example and it does not give this
type of behavior, of course.
I don't think this aliasing is necessarily good in JavaScript but I may
need to present exactly the case that it doesn't work.
Thanks,
Peter
var foo = function(){
return "foo";
}
var alias = foo;
document.write(foo()); // foo
document.write(alias()); // foo
foo = function(){
return "changed";
}
document.write(foo()); // changed
document.write(alias()); // foo // if the alias variable really was
an alias this would output "changed"