I have a very simple javascript hash (object that is only properties):
var original_color = {
r: 214,
g: 124,
b: 55
};
I want to copy the entire hash and then alter it:
var new_color = original_color;
new_color.r = 50;
Does javascript have any built in way to copy dictionaries? Or is there some other JS data type I'm supposed to be using for working with hashes / dictionaries?
There's a related question on SO about cloning objects: How do I correctly clone a JavaScript object?. But I'm surprised there is no easy way to simply copy a hash, or essentially an object that only has properties and no methods, prototype, etc.