S
Stephan Walter
Hi,
I'm hacking on a LISP interpreter in JS [1], and running into trouble
with numbers and Number objects.
This is what I have:
var a = new Number(1);
var b = a;
document.writeln(a == b); // true
b = 2;
document.writeln(a == b); // false
document.writeln(a); // 1
Instead of replacing the *Number object* b with the *number* 2, I'd like
to assign 2 to the value of the Number object, which should still be
referenced by b *and* a. In other words, the two last lines should
output "true" and "2".
Regards,
Stephan Walter
[1] http://www.parkscomputing.com/lisptest.html (not by me)
I'm hacking on a LISP interpreter in JS [1], and running into trouble
with numbers and Number objects.
This is what I have:
var a = new Number(1);
var b = a;
document.writeln(a == b); // true
b = 2;
document.writeln(a == b); // false
document.writeln(a); // 1
Instead of replacing the *Number object* b with the *number* 2, I'd like
to assign 2 to the value of the Number object, which should still be
referenced by b *and* a. In other words, the two last lines should
output "true" and "2".
Regards,
Stephan Walter
[1] http://www.parkscomputing.com/lisptest.html (not by me)