Javascript concatenate properties from multiple objects (associative array)

Posted by Vlad on Stack Overflow See other posts from Stack Overflow or by Vlad
Published on 2010-03-16T12:35:25Z Indexed on 2010/03/16 13:46 UTC
Read the original article Hit count: 174

Filed under:
|

I am looking for the best way to augment multiple javascript associative arrays.

For example the following code

a = { "one" : 1, "two" : 2 };
b = { "three" : 3 };
c = { "four" : 4, "five" : 5 };

d = Collect(a,b,c)

Should result in value of d being:

{ "one" : 1, "two" : 2, "three" : 3, "four" : 4, "five" : 5   };

What is the best way to do this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX