If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

When the following code is run palette[0].r continues to change to whatever palette[icols].r is. It's as if the whole array changes whenever one element is changed. I'm new to javascript, but I've used C++ a lot. So what's going on here?

If you used C++ a lot, then you probably know about objects. They're passed and assigned by reference (by pointer). In your JavaScript, you only ever created one object, and you're assigning the same object reference to every element of the array. That's why changing one element changes them all... because they're all references to the same object.